UrlRoutingHandler UrlRoutingHandler UrlRoutingHandler UrlRoutingHandler Class

定義

做為多個類別的基底類別 (Base Class),這些類別讓您能自訂 ASP.NET 路由處理要求的方式。Serves as base class for classes that enable you to customize how ASP.NET routing processes a request.

public ref class UrlRoutingHandler abstract : System::Web::IHttpHandler
public abstract class UrlRoutingHandler : System.Web.IHttpHandler
type UrlRoutingHandler = class
    interface IHttpHandler
Public MustInherit Class UrlRoutingHandler
Implements IHttpHandler
繼承
UrlRoutingHandlerUrlRoutingHandlerUrlRoutingHandlerUrlRoutingHandler
實作

備註

您可以自訂如何 ASP.NET 路由處理要求所使用時,將檔案的副檔名對應到特定的路由處理常式,而不是UrlRoutingModule為每個要求的路由處理常式的類別。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.

若要自訂如何 ASP.NET 路由處理具有特定副檔名的 URL 的要求,您會建立衍生自類別UrlRoutingHandler類別。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. 例如,您可以建立自訂的路由處理常式來處理要求的檔案副檔名.abcFor example, you can create a customized routing handler that processes requests for a file that has the extension .abc.

若要註冊特定副檔名的自訂處理常式,您必須在 Web.config 檔案中加入該處理常式。To register a customized handler for a particular file name extension, you must add that handler in the Web.config file. 下列範例示範如何註冊 ASP.NET 網站在 IIS 6.0 中執行的自訂處理常式或IIS 7.0IIS 7.0以傳統模式。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.0IIS 7.0 in Classic mode.

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

下列範例示範如何註冊 ASP.NET 網站中執行相同的處理常式IIS 7.0IIS 7.0The following example shows how to register the same handler for an ASP.NET Web site that is running in IIS 7.0IIS 7.0.

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

建構函式

UrlRoutingHandler() UrlRoutingHandler() UrlRoutingHandler() UrlRoutingHandler()

初始化 UrlRoutingHandler 類別的新執行個體。Initializes a new instance of the UrlRoutingHandler class.

屬性

IsReusable IsReusable IsReusable IsReusable

取得值,這個值表示另一個要求是否可以使用 UrlRoutingHandler 執行個體。Gets a value that indicates whether another request can use the UrlRoutingHandler instance.

RouteCollection RouteCollection RouteCollection RouteCollection

取得或設定 ASP.NET 應用程式之定義的路徑集合。Gets or sets the collection of defined routes for the ASP.NET application.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ProcessRequest(HttpContext) ProcessRequest(HttpContext) ProcessRequest(HttpContext) ProcessRequest(HttpContext)

處理與路徑相符的 HTTP 要求。Processes an HTTP request that matches a route.

ProcessRequest(HttpContextBase) ProcessRequest(HttpContextBase) ProcessRequest(HttpContextBase) ProcessRequest(HttpContextBase)

處理與路徑相符的 HTTP 要求。Processes an HTTP request that matches a route.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)
VerifyAndProcessRequest(IHttpHandler, HttpContextBase) VerifyAndProcessRequest(IHttpHandler, HttpContextBase) VerifyAndProcessRequest(IHttpHandler, HttpContextBase) VerifyAndProcessRequest(IHttpHandler, HttpContextBase)

在衍生類別中覆寫時,驗證 HTTP 處理常式並執行處理要求所需的步驟。When overridden in a derived class, validates the HTTP handler and performs the steps that are required to process the request.

明確介面實作

IHttpHandler.IsReusable IHttpHandler.IsReusable IHttpHandler.IsReusable IHttpHandler.IsReusable

取得值,這個值表示另一個要求是否可以使用 UrlRoutingHandler 執行個體。Gets a value that indicates whether another request can use the UrlRoutingHandler instance.

IHttpHandler.ProcessRequest(HttpContext) IHttpHandler.ProcessRequest(HttpContext) IHttpHandler.ProcessRequest(HttpContext) IHttpHandler.ProcessRequest(HttpContext)

處理與路徑相符的 HTTP 要求。Processes an HTTP request that matches a route.

適用於

另請參閱