.Net Restart an ASP.NET application programmatically without editing the web.config

Windows oddly.. but a good friend found this it’s on her site:

http://rochcass.wordpress.com/2013/03/28/restart-an-asp-net-application-programmatically-without-editing-the-web-config/

to quote:

Several times I would be working on a site and some data would not change due to session variables or the .NET cache. This can’t be eliminated by clearing the browser cache but would need the whole ASP.NET application to be restarted to clear all sessions and cache. A traditional way of doing so is to edit the web.config slightly (a space, comma, fullstop would do the trick) … however this was happening often so I decided to restart my application automatically through my code. To do so, I used the Global.ascx on application_start and added this simple line of code which restarts the ADO.NET application:

System.Web.HttpRuntime.UnloadAppDomain();

 

Thanks Roch..

nJoy;-)

 

Leave a Reply

Your email address will not be published. Required fields are marked *