Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 20th, 2004, 06:35 PM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Time of HttpContext

Hello All

i want to know that after how much time the HttpContext.Current.Application expired?

Thank you in advanced

kamlesh.....

 
Old April 21st, 2004, 01:36 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing data in HttpContext, concurrency issue jlrolin ASP.NET 2.0 Professional 0 March 30th, 2008 06:25 PM
HttpRuntime vs HttpContext r_adarsh .NET Framework 1.x 1 February 19th, 2008 10:50 AM
Error - context As HttpContext not defined netasp BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 28th, 2005 11:34 PM
HTTPContext + SitePrincipal error (Wiggly Line) eureka BOOK: ASP.NET Website Programming Problem-Design-Solution 3 September 7th, 2004 09:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.