01.
<%@ Page Language=
"C#"
Debug=
"true"
%>
02.
<script runat=
"server"
>
03.
04.
void
Page_Load(Object sender, EventArgs e)
05.
{
06.
Application[
"Database"
] =
"mydatabase.mdb"
;
07.
Application[
"UserID"
] =
"myuser"
;
08.
Application[
"Password"
] =
"mypassword"
;
09.
10.
Application.Contents.RemoveAll();
11.
12.
if
(Application.Count == 0)
13.
{
14.
this
.lblText.Text =
"Application is nothing"
;
15.
}
16.
else
17.
{
18.
ViewApplication();
19.
}
20.
}
21.
22.
void
ViewApplication()
23.
{
24.
foreach
(String items
in
Application.Contents)
25.
{
26.
this
.lblText.Text =
this
.lblText.Text + items +
" = "
+ Application[items] +
"<br>"
;
27.
}
28.
}
29.
30.
</script>
31.
<html>
32.
<head>
33.
<title>ThaiCreate.Com ASP.NET - Application Object</title>
34.
</head>
35.
<body>
36.
<form id=
"form1"
runat=
"server"
>
37.
<asp:Label id=
"lblText"
runat=
"server"
></asp:Label>
38.
</form>
39.
</body>
40.
</html>