Write Text in Notepad files Using Asp.net
In asp.net Provide many Supporting Classes and Objects files. To write Text or data in Notepad Files Using Your Asp.net and windows Applications. Using StreamWriter Class to write a Text files in Notepad.
Using Class file using System.IO and point to the Text files and open the text files.
Using Class file using System.IO and point to the Text files and open the text files.
StreamWriter streamwriter;
streamwriter= new StreamWriter(File.Open(Server.MapPath("~/sample.txt"), FileMode.OpenOrCreate));
streamwriter.WriteLine(" ******************************** "); streamwriter.WriteLine(" Heading ");
streamwriter.WriteLine(" *************** ");
streamwriter.WriteLine(" Sub Heading ");streamwriter.WriteLine(" Date: " + DateTime.Now() );
streamwriter.Close();
if you want view Notepad files in Web Browser Use Below Code After streamwriter.Close()
Response.Redirect("sample.txt");
Comments
Post a Comment
Thank You for your Comment