13.07.2015 Views

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

374<strong>ASP</strong>.<strong>NET</strong> <strong>3.5</strong>: A Beginner’s <strong>Guide</strong>C# WriteTx.aspx.csusing System;using System.IO;public partial class WriteTx : System.Web.UI.Page{private StreamWriter sw;private string first;private string second;private string third;{}protected void Page_Load(object sender, EventArgs e){using (sw = new StreamWriter(@"C:\WriteStuff\<strong>ASP</strong>Note.txt"))}}first = "This has a line break at the end.";second = "No line break...";third = "so this is on the same line.";sw.WriteLine(first);sw.Write(second);sw.WriteLine(third);writer.Text = "Your file has been written.";Once you have tested the program, open the target folder, WriteStuff, and you shouldsee a new file as shown in Figure 15-1.Figure 15-1 A new text file is created in the target director.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!