有没有什么方法可以从Global.asax的Application_Start事件中确定托管网站的URL?如何确定Global.asax Application_Start事件中的服务器URL和端口
我试图存储的网址,以便我的应用程序可以生成从后台进程通过电子邮件发送的动态链接。
如果我尝试直接访问这个方法HttpApplication.Request对象,我得到一个运行时错误:
System.Web.HttpException: Request is not available in this context
为什么不能在'Session_Start'中完成? – Oded 2012-01-14 22:06:33
在集成模式下在IIS 7或更高版本上运行时,当前的HTTP上下文在Application_Start时不可用。正如@Oded所说,Session_Start会起作用 - 就像Application_BeginRequest一样,尽管Session_Start被调用的次数少得多。 – Dubs 2012-04-10 18:37:02