protected void Button1_Click(object sender, EventArgs e)
{
string sTitle = "健康專欄第100期";
string html = "<html><head>";
html += "<meta name='viewport' content='width=device-width' />";
html += "<meta charset='utf-8' />";
html += "<body>";
html += "<h1>" + sTitle + "</h1>";
html += "<button id='btnShow'>顯示信息</button>";
html += "</body></head></html>";
try
{
StreamWriter sw = new StreamWriter(Server.MapPath("html/" + sTitle + ".html"), false, System.Text.Encoding.UTF8);
sw.WriteLine(html);
sw.Close();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
.net保存html文件
最新推荐文章于 2023-01-09 15:26:58 发布