What is the difference between the HttpRequestContext and HttpRequest? And how to convert the HttpRequestContext to HttpRequest?
What is the difference between the HttpRequestContext and HttpRequest? And how to convert the HttpRequestContext to HttpRequest?
As far as I know, HttpRequestContext
is an object that is "inside" of HttpRequest
.
The HttpRequest
( System.Web.HttpRequest
) returns the current request, where we can read QueryString
for example.
The HttpRequestContext
( System.Web.Routing.RequestContext
) is the request within the current route, a MVC
route for example. So much so that if a request not made through a route, for a direct page for example, HttpRequestContext
is empty.
Converting a HttpRequestContext
should not be a problem since it is always a request, so HttpRequest
must be filled with the request data.
Note that HttpRequestContext
inherits from RequestContextBase
, which in turn inherits from RequestContext
, this may help.