<%@ Import Namespace="System.IO"%> <%@ Page Language="C#" Debug="true" %> <script runat="server"> void Page_Load(object sender, EventArgs e) { StreamWriter StrWer = default(StreamWriter); try { StrWer = File.CreateText(Server.MapPath("MyFiles/") + "thaicreate.txt"); StrWer.Write("www.ThaiCreate.Com"); StrWer.Write("Version 2009"); StrWer.WriteLine(""); StrWer.WriteLine("www.ThaiCreate.Com"); StrWer.WriteLine("Version 2009"); StrWer.Close(); this.lblStatus.Text = "Files Writed."; } catch (Exception ex) { this.lblStatus.Text = "Write failed. (" + ex.Message + ")"; } } </script> <html> <head> <title>ThaiCreate.Com ASP.NET - Write Text Files</title> </head> <body> <form runat="server"> <asp:Label id="lblStatus" runat="server"></asp:Label> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท