How to restart application

A

ad

I want to renew all values of Application and Session.
How can I restart application in program?
 
P

Peter Rilling

How about something like Application.Clear() and Session.Clear().

You probably do not want the code to be able to restart itself, but if you
are desperate, you could also spawn a process to the "iisreset" command.
 
A

ad

Thanks,

After execute Application.Clear(), and Session.Clare() can I execute the
code in Global.asax's Application_Start and Session_Start event?
 
P

Peter Rilling

Those will just clear the variables, not restart the app or session. I do
not think you can (or should) programmatically restart the app. You could
all Session.Abandon() to restart the session.

If there is some code that you want to run after you reset the variables and
when the app/session starts, I would suggest creating some function that
both places can call.
 

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

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,145
Latest member
web3PRAgeency
Top