I read about HTTPContext
And ControllerContext
in MVC (fundamentalbook), but i don't know what is exactly HTTPContext
And ControllerContext
.
Could some one please explain these methods?
ControllerContext(HttpContextBase, RouteData, ControllerBase) Initializes a new instance of the ControllerContext class by using the specified HTTP context, URL route data, and controller.
The HttpContext encapsulates all the HTTP-specific information about a single HTTP request. When an HTTP request arrives at the server, the server processes the request and builds an HttpContext object. This object represents the request which your application code can use to create the response.
MVC 6 is a part of ASP.NET 5 that has been designed for cloud-optimized applications. The runtime automatically picks the correct version of the library when our MVC application is deployed to the cloud. The Core CLR is also supposed to be tuned with a high resource-efficient optimization.
ControllerBase : A base class for an MVC controller without view support. Controller : A base class for an MVC controller with view support. Thus if we are not creating views i.e. creating Web API use ControllerBase else use Controller.
HttpContext
will give information about an individual HTTP request. ControllerContext
will give information about an HTTP request for a specified controller.
See links below for more info....
HttpContext:
http://msdn.microsoft.com/en-us/library/system.web.httpcontext.aspx
ControllerContext:
http://msdn.microsoft.com/en-us/library/system.web.mvc.controllercontext(v=vs.108).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With