<%@ Page Language="C#" Debug="true" %> <script runat="server"> void Page_Load(Object sender, EventArgs e) { Application["Database"] = "mydatabase.mdb"; Application["UserID"] = "myuser"; Application["Password"] = "mypassword"; ViewApplication(); } void ViewApplication() { this.lblText1.Text = Application["Database"].ToString(); this.lblText2.Text = Application["UserID"].ToString(); this.lblText3.Text = Application["Password"].ToString(); } </script> <html> <head> <title>ThaiCreate.Com ASP.NET - Application Object</title> </head> <body> <form id="form1" runat="server"> <asp:Label id="lblText1" runat="server"></asp:Label><br /> <asp:Label id="lblText2" runat="server"></asp:Label><br /> <asp:Label id="lblText3" runat="server"></asp:Label><br /> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท