读取服务器端文本文件到客户端的文本框

string filename = Server.MapPath("tt.txt");
   //StreamReader sr = File.OpenText(filename);
StreamReader sr = new StreamReader(filename, Encoding.Default);
   //srReadLine.BaseStream.Seek(0, SeekOrigin.Begin);
StringBuilder sb = new StringBuilder();
sb.Append(sr.ReadToEnd());
sr.Close();
TextBox1.Text = sb.ToString();

你可能感兴趣的:(文本文件)