String strfile= "Asp.txt";
String strout=string. Empty;
if (! File.exists (System.Web.HttpContext.Current.Server.MapPath (strfile)))
{
}
else
{
using ( StreamReader sr = new StreamReader (System.Web.HttpContext.Current.Server.MapPath (strfile), System.Text.Encoding.Default))
{
strout= Sr. ReadToEnd ();
}
Response.Write ("SSSs");
=============================== "TXT document is relatively small, the content is very few when a kind of writing"
using System.test;
String txt = file.readalltext ("D:\\aaa.sys", Encoding.default);
Response.Write ("" "+ txt +" "");
System.IO.File.WriteAllText ("E:\\asp_1.txt", "I Love You!wang na"); Be sure to have absolute path
String txtpath = Server.MapPath ("~\\public\\attinfo\\") + "Test.txt";
StreamWriter sw = new StreamWriter (Txtpath, False, System.Text.Encoding.Default);
Sw. WriteLine ("Hello World");
Sw. WriteLine (""); Output empty line
SW. WriteLine ("ASP. NET network programming. ");
Sw. Close ();