Hi there,
It doesn't expire; it's there for the life time of the application.
However, the application state gets lost when the server restarts or reboots.
You can check this with a simple example. Add the following code to the top of your page:
Code:
Private Sub Page_Load(Sender As Object, E As EventArgs )
If Application("MyTest") Is Nothing Then
Application("MyTest") = System.DateTime.Now.ToString()
End If
lblTest.Text = Application("MyTest").ToString()
End Sub
Also add a label to your page:
Code:
<asp:Label ID="lblTest" runat="Server" />
Save and run the page. You'll notice it displays the time. Refresh the page a couple of times. You'll notice it displays the old time. Keep refreshing until you're bored; the time will stay the same. As long as nothing happens to the server, the variables in application state will stay alive.
Now, restart IIS (choose Restart IIS...) from the All Tasks menu. Wait until IIS is up again and refresh your page. You'll notice the new time.....
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
Release by
The Tea Party (Track 6 from the album:
Transmission)