Create and write a text file (simple) New .aspx (mainly streamwriter and streamreader) using system.io; // Do not have less private void button1_click (Object sender, system.eventargs e) {streamwriter sw; // Calling the File class CreateText method Returns a streamwriter After creating streamWriter, you can call its Write method to write text to the file SW = file.createtext (MAPPATH ("Ok.txt")); sw.writeline (TextBox1.text) Sw.close ();} private void button2_click (object sender, system.eventargs e) {// read text streamreader sr; // Decision path if the file exists
IF (file.exists ("ok.txt")))) {sr = file.opentext (mappath ("ok.txt")); TextBox1.text = sr.readline ();} else textbox1.text = " file does not exist!"; }