<%@ 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"; Application.Contents.RemoveAll(); if(Application.Count == 0) { this.lblText.Text = "Application is nothing"; } else { ViewApplication(); } } void ViewApplication() { foreach(String items in Application.Contents) { this.lblText.Text = this.lblText.Text + items + " = " + Application[items] + "<br>"; } } </script> <html> <head> <title>ThaiCreate.Com ASP.NET - Application Object</title> </head> <body> <form id="form1" runat="server"> <asp:Label id="lblText" runat="server"></asp:Label> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท