Get website URL from Application_Start?

Hi,

I need to create the correct action URL on my APS.NET MVC 3 website, and this needs to be done in Application_Start in Gloabl.asax.

I tried installing UrlHelper, but is HttpContext.Current always null?

The address I'm looking for looks something like this: http://www.mysite.se/MyController/MyAction .

I also tried VirtualPathUtility.ToAbsolute ("~ /"), but that will only give me "/ mysite /"

+5
source share
1 answer

, HttpContext Application_Start, IIS ( , ).

, Application_BeginRequest, - , .

+12

All Articles