Global.asax ?

W

WJ

Is the "Application_Start" event on Global.asax created by the "very first
user" who visits the Asp.Net web site ? Or is it started per user ? If it is
the first case, how do you flush the global variables without shutting down
the web site ?

Thanks

John
 
M

Marshal Antony

Hi John,
Application_OnStart handler is executed only once in the lifetime of an
application
and not for every application instance.The application object is available
in all pages or all modules of the
application.You can add items to the Application object,For eg:
Application["test1"]="Test 1";
Once an item is added like this it is available to all pages or modules
within the application.
To remove the item added above,
Application.Remove("test1");
You can also use Clear or RemoveAll method to remove all items from a
Application state.
Application.RemoveAll(); // this will remove all items from the application
state.

Hope this helps.
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com
 
G

Ganesan Subramanian

If you are using IIS5.0 with Windows 2000 server or older, in website
properties, remove and create the "Application".
If you are using Windows server 2003, stop and start the "Application Pool"
for that website from IIS console.
 
S

Scott Allen

The runtime only invokes Application_Start once during the lifetime of
the application.

Can you tell us a bit more about your variables and what you need to
do to flush them (reinitialize them?). It could be as easy as moving
the initialization code into a different method in the Global class,
and invoking that method when an event happens where you need to reset
global state.

There is an article here that has more information about the Global
class and how it related to application state:
http://odetocode.com/Articles/89.aspx

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top