读取的方法帮在页面的标题
public void bingtitle()
{
string path =Server.MapPath("~//App_Data//title.Txt"); //路径
System.IO.StreamReader reader = new System.IO.StreamReader(path, System.Text.Encoding.Default);
string str= reader.ReadLine();
this.Header.Title = str.ToString();
reader.Close();
}
//修改的方法
protected void bto_Edit_Click(object sender, EventArgs e)
{
string title=txt_title.Text.ToString().Trim();
string path = Server.MapPath("~//App_Data//title.Txt");
System.IO.StreamReader reader = new System.IO.StreamReader(path, System.Text.Encoding.Default);
string str = reader.ReadLine();
reader.Close();
string s = str.Replace(str, title);
System.IO.StreamWriter sw = new System.IO.StreamWriter(path, false, System.Text.Encoding.Default);
sw.WriteLine(s);
sw.Close();
Response.Write("<script>alert('修改成功!')</script>");
}