I have this entry in web.config
<appSettings>
<add key="pingUrl" value="http://examplesite.com/login.aspx"/>
</appSettings>
I have the below code in Global.asax.cs to automatically start the IIS when it is recycle
void Application_End(object sender, EventArgs e)
{
try
{
string pingUrl = ConfigurationManager.AppSettings["pingUrl"];
WebClient http = new WebClient();
string Result = http.DownloadString(pingUrl);
}
catch (Exception ex)
{
string Message = ex.Message;
}
}
My Question is can I detect the application forms authentication login page url in Application_End method some how? Instead of reading entry from <appSettings/>
Note: I am using Quartz.Net in my MVC4 application and it is stop working when IIS recycle. I read IIS app pool recycle + quartz scheduling and many SO links but no use. We use external hosting provider, so we dont have a control of changing a physical config file.
After reading http://weblog.west-wind.com/posts/2007/May/10/Forcing-an-ASPNET-Application-to-stay-alive I decided to go with this solution.
Check out the MSDN docs on
FormsAuthentication.LoginUrl
.If you have your forms authentication set up in web.config's
<authentication>
element, and you have the "loginURL" populated there, then the property mentioned above should have the information you're looking for.