Is there any way to determine the url on which a website is being hosted from the Global.asax’s Application_Start event?
I’m trying to store the url so that my application can generate dynamic links that are emailed from a background process.
If I try to directly access the HttpApplication.Request object in this method, I get a runtime error:
System.Web.HttpException: Request is not available in this context
I ended up putting my code in the Global.asax’s Application_BeginRequest event.