Don't think this is entirely true. A change in the web.config file forces a
restart of the application which results in the resulting of the application
object. It is true that ASP.NET monitors the virtual directory, if a file is
changed there, for example a code behind file which is referenced by the src
attribute of the page directive, this forces a recompilation of the .aspx
page. However, this doesn't result in an application restart as can be
checked by adding the following code to an .aspx page:
DateTime objDate;
if ( Application["Time"] == null )
{
Application.Lock();
Application["Time"] = DateTime.Now;
objDate = DateTime.Now;
Application.UnLock();
}
else
{
objDate = (DateTime) Application["Time"];
}
Response.Write(objDate.ToString());
Kind regards,
Nikander & Margriet Bruggeman
"Shaun" wrote:
I am not sure if there is a method call or something that would restart your
application (will find out and let you know if any ) but one way in which you
can restart your application is by changing a File ( say a log file or
something )in your virtual directory.As ASP.NET monitors the Virtual
directory adn any change in the file would trigger a restart.
Hope this helps
Shaun
"Pint" wrote:
I would like to know if there is a programatic way to force the
Application object to restart. I have a hosted website where I will be
unable to control the webserver (eg:iisreset), and I would like to be
able to trap certain events and cause the entire application to reload.
Thanks in advance.
-Pint