日期:2014-05-19  浏览次数:20642 次

急!!!
急啊..替换Html中的 ***  怎么都不能成功啊?


private   void   Button1_Click(object   sender,   System.EventArgs   e)
{
String   Title=TextBox1.Text.ToString();
String   ss=FCKeditor1.Value.ToString();
String   TempStr=ReadFromHtml().ToString();
TempStr.Replace( "**** ",Title);
TempStr.Replace( "#### ",ss);
WriteToHtml(TempStr);

}

public   string   ReadFromHtml()
{
System.IO.StreamReader   sr   =   new   System.IO.StreamReader(Server.MapPath( "..\\templet.htm "),System.Text.Encoding.Default);
string   str=   sr.ReadToEnd();
sr.Close();
return   str;


}

public   void   WriteToHtml(String   Cont)
{    
StreamWriter   sr   =   new   StreamWriter(Server.MapPath( "..\\1.html "),false,System.Text.Encoding.Default);
sr.WriteLine   (Cont);
sr.Close();

}




------解决方案--------------------
TempStr.Replace( "**** ",Title); => TempStr = TempStr.Replace( "**** ",Title);