UrlRoutingHandler Класс
Определение
Служит базовым классом для классов, которые позволяют настраивать порядок обработки запроса маршрутизации 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
- Наследование
-
UrlRoutingHandler
- Реализации
Комментарии
Вы можете настроить, как 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. Например, можно создать пользовательский обработчик маршрутизации, обрабатывающий запросы к файлу с расширением .abc
.For 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.0 .The 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.Initializes a new instance of the UrlRoutingHandler class. |
Свойства
IsReusable |
Получает значение, указывающее, может ли другой запрос использовать экземпляр UrlRoutingHandler.Gets a value that indicates whether another request can use the UrlRoutingHandler instance. |
RouteCollection |
Получает или задает коллекцию определенных маршрутов для приложения ASP.NET.Gets or sets the collection of defined routes for the ASP.NET application. |
Методы
Equals(Object) |
Определяет, равен ли указанный объект текущему объекту.Determines whether the specified object is equal to the current object. (Унаследовано от Object) |
GetHashCode() |
Служит хэш-функцией по умолчанию.Serves as the default hash function. (Унаследовано от Object) |
GetType() |
Возвращает объект Type для текущего экземпляра.Gets the Type of the current instance. (Унаследовано от Object) |
MemberwiseClone() |
Создает неполную копию текущего объекта Object.Creates a shallow copy of the current Object. (Унаследовано от Object) |
ProcessRequest(HttpContext) |
Обрабатывает HTTP-запрос, который соответствует маршруту.Processes an HTTP request that matches a route. |
ProcessRequest(HttpContextBase) |
Обрабатывает HTTP-запрос, который соответствует маршруту.Processes an HTTP request that matches a route. |
ToString() |
Возвращает строку, представляющую текущий объект.Returns a string that represents the current object. (Унаследовано от Object) |
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 |
Получает значение, указывающее, может ли другой запрос использовать экземпляр UrlRoutingHandler.Gets a value that indicates whether another request can use the UrlRoutingHandler instance. |
IHttpHandler.ProcessRequest(HttpContext) |
Обрабатывает HTTP-запрос, который соответствует маршруту.Processes an HTTP request that matches a route. |