This topic has not yet been rated - Rate this topic

UrlRoutingHandler Class

Serves as base class for classes that enable you to customize how ASP.NET routing processes a request.

System.Object
  System.Web.Routing.UrlRoutingHandler

Namespace:  System.Web.Routing
Assembly:  System.Web (in System.Web.dll)
public abstract class UrlRoutingHandler : IHttpHandler

The UrlRoutingHandler type exposes the following members.

  Name Description
Protected method UrlRoutingHandler Initializes a new instance of the UrlRoutingHandler class.
Top
  Name Description
Protected property IsReusable Gets a value that indicates whether another request can use the UrlRoutingHandler instance.
Public property RouteCollection Gets or sets the collection of defined routes for the ASP.NET application.
Top
  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method ProcessRequest(HttpContext) Processes an HTTP request that matches a route.
Protected method ProcessRequest(HttpContextBase) Processes an HTTP request that matches a route.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Protected method VerifyAndProcessRequest When overridden in a derived class, validates the HTTP handler and performs the steps that are required to process the request.
Top
  Name Description
Explicit interface implemetation Private property IHttpHandler.IsReusable Gets a value that indicates whether another request can use the UrlRoutingHandler instance.
Explicit interface implemetation Private method IHttpHandler.ProcessRequest Processes an HTTP request that matches a route.
Top

You can customize how ASP.NET routing handles requests by mapping a file name extension to a particular routing handler instead of by using the UrlRoutingModule class as the routing handler for every request.

To customize how ASP.NET routing handles a request for a URL with a specific file name extension, you create a class that derives from the UrlRoutingHandler class. For example, you can create a customized routing handler that processes requests for a file that has the extension .abc.

To register a customized handler for a particular file name extension, you must add that handler in the Web.config file. The following example shows how to register a customized handler for an ASP.NET Web site that is running in IIS 6.0 or IIS 7.0 in Classic mode.

<system.web>
  <httpHandlers>
    <add verb="*" path="*.abc" 
        type="Contoso.Routing.CustomRoutingHandler" />
  </httpHandlers>
</system.web>

The following example shows how to register the same handler for an ASP.NET Web site that is running in IIS 7.0.

<system.webServer>
  <handlers>
    <add verb="*" path="*.abc"
        type="Contoso.Routing.CustomRoutingHandler" 
        resourceType="Unspecified" />
  </handlers>
</system.webServer>

.NET Framework

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ