62,267
社区成员
发帖
与我相关
我的任务
分享
string biaoti1 = biaoti.Text.ToString(), neirong2 = neirong.Text.ToString();
string neirong1 = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<title>测试页</title>\r\n</head>\r\n<body>\r\n" + (neirong2.Replace("\r\n", "<br/>")) + "\r\n</body>\r\n</html>";
string adds = Server.MapPath(".") + "\\html\\" + biaoti1 + ".htm";
StreamWriter f = new StreamWriter(adds);
f.Write(neirong1);
f.Close();
Response.Write("生成成功;<a target='_blank' href='"+adds+"'>"+adds+"</a>");
System.IO.StringWriter sw = new System.IO.StringWriter();
Server.Execute("default.aspx?toHtml=1",sw);
System.IO.StreamWriter stremwriter = new System.IO.StreamWriter(Server.MapPath("aa.html"),false,System.Text.Encoding.Default);
stremwriter.Write(sw.ToString() );
stremwriter.Close();
Response.Redirect("aa.html");