Export (0) Print
Expand All

MvcHttpHandler Class

.NET Framework 4

Verifies and processes an HTTP request.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

public class MvcHttpHandler : UrlRoutingHandler, 
	IHttpAsyncHandler, IHttpHandler, IRequiresSessionState

The MvcHttpHandler type exposes the following members.

  NameDescription
Public methodMvcHttpHandlerInitializes a new instance of the MvcHttpHandler class.
Top

  NameDescription
Protected propertyIsReusableGets a value that indicates whether another request can use the UrlRoutingHandler instance. (Inherited from UrlRoutingHandler.)
Public propertyRouteCollectionGets or sets the collection of defined routes for the ASP.NET application. (Inherited from UrlRoutingHandler.)
Top

  NameDescription
Protected methodBeginProcessRequest(HttpContext, AsyncCallback, Object)Called by ASP.NET to begin asynchronous request processing.
Protected methodBeginProcessRequest(HttpContextBase, AsyncCallback, Object)Called by ASP.NET to begin asynchronous request processing.
Protected methodEndProcessRequestCalled by ASP.NET when asynchronous request processing has ended.
Public methodEqualsDetermines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodProcessRequest(HttpContext)Processes an HTTP request that matches a route. (Inherited from UrlRoutingHandler.)
Protected methodProcessRequest(HttpContextBase)Processes an HTTP request that matches a route. (Inherited from UrlRoutingHandler.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Protected methodVerifyAndProcessRequestVerifies and processes an HTTP request. (Overrides UrlRoutingHandler.VerifyAndProcessRequest(IHttpHandler, HttpContextBase).)
Top

  NameDescription
Explicit interface implemetationPrivate methodIHttpAsyncHandler.BeginProcessRequestCalled by ASP.NET to begin asynchronous request processing.
Explicit interface implemetationPrivate methodIHttpAsyncHandler.EndProcessRequestCalled by ASP.NET when asynchronous request processing has ended.
Explicit interface implemetationPrivate propertyIHttpHandler.IsReusableGets a value that indicates whether another request can use the UrlRoutingHandler instance. (Inherited from UrlRoutingHandler.)
Explicit interface implemetationPrivate methodIHttpHandler.ProcessRequestProcesses an HTTP request that matches a route. (Inherited from UrlRoutingHandler.)
Top

MVC includes the following handler types:

  • MvcHandler. This handler is responsible for initiating the ASP.NET pipeline for an MVC application. It receives a Controller instance from the MVC controller factory; this controller handles further processing of the request. Note that even though MvcHandler implements IHttpHandler, it cannot be mapped as a handler (for example, to the .mvc file-name extension) because the class does not support a parameterless constructor. (Its only constructor requires a RequestContext object.)

  • MvcRouteHandler. This class implements IRouteHandler, therefore it can integrate with ASP.NET routing. The MvcRouteHandler class associates the route with an MvcHandler instance. A MvcRouteHandler instance is registered with routing when you use the MapRoute method. When the MvcRouteHandler class is invoked, the class generates an MvcHandler instance using the current RequestContext instance. It then delegates control to the new MvcHandler instance.

  • MvcHttpHandler. This handler is used to facilitate direct handler mapping without going through the routing module. This is useful if you want to map a file-name extension such as .mvc directly to an MVC handler. Internally, MvcHttpHandler performs the same tasks that ASP.NET routing ordinarily performs (going through MvcRouteHandler and MvcHandler). However, it performs these tasks as a handler instead of as a module. This handler is not typically used when the UrlRoutingModule is enabled for all requests.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft