检测Application_End站点登录网址 [英] Detect site login url in Application_End
问题描述
我在web.config中此项
I have this entry in web.config
<appSettings>
<add key="pingUrl" value="http://examplesite.com/login.aspx"/>
</appSettings>
我在Global.asax.cs中下面的code时,它是循环自动启动IIS
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;
}
}
我的问题是的我可以检测申请表验证登录页面的URL在Application_End方法,一些如何?而不是从阅读条目&LT;的appSettings /&GT;
请注意:我使用Quartz.Net我MVC4应用程序,它被停止工作时,IIS回收。我读 IIS应用程序池回收+石英调度和许多SO链接,但没有用。我们使用外部托管服务提供商,所以我们没有改变物理配置文件的控制。
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.
阅读的http://weblog.west-wind.com/posts/2007/May/10/Forcing-an-ASPNET-Application-to-stay-alive我决定去与此解决方案。
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.
推荐答案
检查出MSDN文档<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.loginurl%28v=vs.110%29.aspx\"相对=nofollow> FormsAuthentication.LoginUrl
。
Check out the MSDN docs on FormsAuthentication.LoginUrl
.
如果你有你的窗体身份验证在web.config中的&LT成立;认证&GT;
元素,你有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.
这篇关于检测Application_End站点登录网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!