Use below code to write text in simple .txt file using ASP.Net with C#:
System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath("C:\\test.txt"));
sw.WriteLine("Kapil Baheti");
sw.Close();
Above code will write "Kapil Baheti" in test.txt file. Also if file is not present at destination then it will be created automatically.
System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath("C:\\test.txt"));
sw.WriteLine("Kapil Baheti");
sw.Close();
Above code will write "Kapil Baheti" in test.txt file. Also if file is not present at destination then it will be created automatically.
No comments:
Post a Comment