MvcRouteHandler Class

Creates an object that implements the IHttpHandler interface and passes the request context to it.

Inheritance Hierarchy

System.Object
  System.Web.Mvc.MvcRouteHandler

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

Syntax

'Declaration
Public Class MvcRouteHandler _
    Implements IRouteHandler
'Usage
Dim instance As MvcRouteHandler
public class MvcRouteHandler : IRouteHandler
public ref class MvcRouteHandler : IRouteHandler
public class MvcRouteHandler implements IRouteHandler

The MvcRouteHandler type exposes the following members.

Constructors

  Name Description
Public method MvcRouteHandler() Initializes a new instance of the MvcRouteHandler class.
Public method MvcRouteHandler(IControllerFactory) Initializes a new instance of the MvcRouteHandler class using the specified factory controller object.

Top

Methods

  Name Description
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Protected method GetHttpHandler Returns the HTTP handler by using the specified HTTP context.
Protected method GetSessionStateBehavior Returns the session behavior.
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Public method ToString (Inherited from Object.)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IRouteHandler.GetHttpHandler Returns the HTTP handler by using the specified request context.

Top

Remarks

ASP.NET MVC includes the following handler types:

  • MvcHandler. This handler is responsible for initiating the ASP.NET pipeline for an ASP.NET 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 ASP.NET 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 class is enabled for all requests.

Thread Safety

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

See Also

Reference

System.Web.Mvc Namespace

Other Resources

Understanding MVC Application Execution