ASP.NET自动生成HTML

try
        
…{
            
string path = HttpContext.Current.Server.MapPath(“”);
            
string temp = HttpContext.Current.Server.MapPath(“HTMLPage.htm“);
            
             Encoding code
= Encoding.GetEncoding(“gb2312“);
             StreamReader sr
= null;
             StreamWriter sw
= null;
            
string str = “”;
             sr
= new StreamReader(temp, code);
             str
= sr.ReadToEnd();
   
            
string htmlfilename = DateTime.Now.ToString(“yyyyMMddHHmmss“) + “.html“;
            
string strText = “测试test <input type=’button’ value=’123123′></input>“;   //这段文本是汉字和英文还有html按钮 通过替换[biaoti]成为新的HTML内容
             str = str.Replace(“[biaoti]“, strText);
             sw
= new StreamWriter(path+htmlfilename, false, code);
             sw.Write(str);
            sw.Flush();
        }

       
catch
        
…{
             Response.Write(
“出错“);

         }



本文固定链接: https://www.ntxz.net/?p=639 | 周忞 | 吉心的记事本



该日志由 吉心 于2010年06月14日发表在 懒得分类, 旧版博客 分类下, 你可以发表评论。
在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: ASP.NET自动生成HTML | 周忞 | 吉心的记事本

ASP.NET自动生成HTML:等您坐沙发呢!

发表评论

您必须 [ 登录 ] 才能发表留言!