Many times, from an administration perspective, it's desirable to restart an ASP.NET web site without restarting IIS on the whole server.
One quick way to do this is to leverage the fact that the application has a cache dependency on the Web.Config file. Writing to the Web.Config file will cause IIS to restart the ASP.NET application. We can also leverage the fact that changing the last update time on the Web.Config will also force a restart of the application.
This will clear all cache and tracing information and has an obvious impact on performance and should only be done from an administration security controlled page.
String szXMLFile; szXMLFile = System.Web.HttpRuntime.AppDomainAppPath; szXMLFile += "Web.Config"; File.SetLastWriteTime(szXMLFile, System.DateTime.Now);