What happened if you need to access the HttpRequest object whitin the event Application_Start of an ASP .NET Web Application ?
Response: you end up with an exception.
Someone might observe that such event is not a valid place for a task like that, but sometimes things are simply different from those that appear at first sight.
So, if you want to get for example the virtual path or the physical path of a web application before the HttpRequest object is constructed this is a valid solution:
Simply use HttpRuntime instead of HttpContext.Current.Request!
Technorati Tags: Web development,ASP .NET
398 thoughts on “[ASP .NET] How to access Request data when HttpContext.Current.Request is unavailable”
Comments are closed.