?????: asp.NET HTTP ??????? ?? HTTP ???????? ?? ??????

???? ?????? ???? ??????
???? ID: 307985 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

?? ????? ??

??????

?? ???? ?? ????? asp.NET HTTP ???? ?? ??? ?????? ????? ?? ??????? ?? HTTP handlers.

???????? asp.NET ???????, ?? ??? ????? Microsoft ???????? ???? ?????:
305140?????: asp.NET Roadmap

???? ???????

HTTP ??????? ?? HTTP handlers asp.NET ??????????? ?? ?? ?????? ?????? ???? ?????? ?? ??????? ???? ?? ??? ??, ?? ?? ?????? (?????? ?? ??? ??????? ??????? ?? ???? ???????) ?? ?? ???? HTTP ??????? ?????? ??????? ???? ?? ?? ?? ???? ??? HTTP ?????? ?????? ??????? ??? ?????? ?????? ?? ??????? ??, ?? ??? ???? ?? HTTP ?????? flows ????????

?? ???? ?? ????? ???????? ??? ??????? ??:

HTTP ???????

??????? before ?? ????????? ???? ?? ?????? ?? ??? ??? ???? ??? ??????? intercept ??? ???, ?? ???????? ???-??? ?????? ?? ??????? ???? ?? ??? ???????? ????? ??? ??????? ???????????IHttpModule????????, ??? ????? ?? ??System.Web??? ????? ???

?????? ???????

???HttpApplication???? ?? ????? ?? ?? ??? ??????? ?????????? ???? ?? ??? ?????? ???? ??? ????? ????? ??????? ?? ???????? ?????? ?? ??? ??????????? ???? ?? ??? ?????? ???? ?? ?????? ?? ?????? ???? ??? ???????? ???:
  • BeginRequest: ?????? ??????? ???? ??? ??? ??? ?? ??? ?????? (?????? ?? ??? ???????? ???????? banners ???????? ????? ?? ????? ??) ?? ?????? ??? ???? ??, ?? ????? ?? ?????????? ???? ?? ???????? ???
  • AuthenticateRequest: ??? ?? ???? ????? ??????? ????? ??? ???? ???? ???? ????? ??? (?????? ?? ???, ????? ??????? ???????? ???? ?? ??? ???? ??????? ?? ??????? ??? ??????????), ?? ?? ????? ?? ?????????? ???? ?? ???? ?? ?????????? authenticates ?? ??????? ??????
  • AuthorizeRequest: ?? ????? (?????? ?? ???, ???? ??????? ??? ???? ????? ?????? ??? ???? ????? ???????? ???? (ACLs) ??? ?????? ???? ?? ???) ????????? ??????? ?? ??????????? ???? ?? ??? internally ????? ???? ???? ??? ?? ?? ????? ?? ??????? ?? ???? ???, ?????? ???? ??? ??? ???? ?? ??? ?? ????? ?????
  • ResolveRequestCache: ????? ?? ????????? ???? ?? ??? ??? ????? ?????? ?? served ???? ?? ???? ???? ??? ?? ???? ?????? ??????? (?????? ?? ???, ?????-?????? ????? ??? ???? ???? ?????? ???) ????? ?? ??? ????? ???, ?? ????? ?? ??? ??? ?? ????? serve ???? ?? ??? ?? ???? ?? ????????? ???? ?? ??? ????????????
  • AcquireRequestState: ???? ?????? ?????? ?????? ?? ??????? ?? ??? ??? ?? ???? ?????? ??????? ??????? ????? ?? ??? ????? ???, ?? ???? ?????? ?? ?????? ?? ???? ?????? grab ???? ?? ??? ?? ????? ?? ???????????
  • PreRequestHandlerExecute: HTTP ?????? ????????? ???? ?? ???? ?? ???? ???? ???
  • PostRequestHandlerExecute: HTTP ?????? ????????? ???? ?? ??? ?? ???? ???? ???
  • ReleaseRequestState: ???? ?????? ?????? ?????? ??? ???????? ??? ??? ?? ??? ????? ???? ?????? ??????? ??? ??? ???, ???? ???? ?????? ?? ?????? ??? ???? ?????? ?????? ???? ??????
  • UpdateRequestCache: ????? ?? ???? ?? ?????? ???? ?????? ??? ???? ?? ???? ??? ?? ??? ????? ??? ??????? ??? ??? ???, ?? ???? ????? ?????? ???? ???? ??? ???? ?? ????
  • EndRequest: ?????? ?? ???? ???? ??? ??? You may want to build a debugging module that gathers information throughout the request and then writes the information to the page.
The following events are available for modules to synchronize with for each request transmission. The order of these events is non-deterministic.
  • PreSendRequestHeaders: This event occurs before the headers are sent. If you want to add additional headers, you can synchronize this event from a custom module.
  • PreSendRequestContent: This event occurs when theResponse.Flush?????? ?? ??? ???? ???? ??? If you want to add additional content, you can synchronize this event from a custom module.
  • ??????.: This event occurs when an unhandled exception occurs. If you want to write a custom error handler module, synchronize this event.

Configuring HTTP Modules

The <httpmodules> configuration section handler is responsible for configuring the HTTP modules within an application. It can be declared at the computer, site, or application level. Use the following syntax for the <httpmodules> section handler: </httpmodules></httpmodules>
<httpModules>
   <add type="[COM+ Class], [Assembly]" name="[ModuleName]" />
   <remove type="[COM+ Class], [Assembly]" name="[ModuleName]" />
   <clear />
</httpModules>
				

Creating HTTP Modules

To create an HTTP module, you must implement theIHttpModuleinterface. TheIHttpModuleinterface has two methods with the following signatures:
void Init(HttpApplication);
void Dispose();
				
For additional information about creating HTTP modules, click the article numbers below to view the articles in the Microsoft Knowledge Base:
308000HOW TO: Create an ASP.NET HTTP Module by Using Visual Basic .NET
307996HOW TO: Create an ASP.NET HTTP Module by Using Visual C# .NET

HTTP Handlers

Handlers are used to process individual endpoint requests. Handlers enable the ASP.NET framework to process individual HTTP URLs or groups of URL extensions within an application. Unlike modules, only one handler is used to process a request. All handlers implement theIHttpHandlerinterface, which is located in theSystem.Web??? ????? ??? Handlers are somewhat analogous to Internet Server Application Programming Interface (ISAPI) extensions.

Configuring HTTP Handlers

The <httphandlers> configuration section handler is responsible for mapping incoming URLs to the </httphandlers>IHttpHandler??,IHttpHandlerFactory????? It can be declared at the computer, site, or application level. Subdirectories inherit these settings.

Administrators use the <add> tag directive to configure the <httphandlers> section. <add> directives are interpreted and processed in a top-down sequential order. Use the following syntax for the <httphandler> section handler: </httphandler></add></httphandlers></add>
<httpHandlers>
   <add verb="[verb list]" path="[path/wildcard]" type="[COM+ Class], [Assembly]" validate="[true/false]" />
   <remove verb="[verb list]" path="[path/wildcard]" />
   <clear />
</httpHandlers>
				

Creating HTTP Handlers

To create an HTTP handler, you must implement theIHttpHandlerinterface. TheIHttpHandlerinterface has one method and one property with the following signatures:
void ProcessRequest(HttpContext);
bool IsReusable {get;}
				
???:: If session state is required in your HTTP handler, you also need to implement theIRequiresSessionStateinterface.For additional information about creating HTTP handlers, click the article numbers below to view the articles in the Microsoft Knowledge Base:
308001HOW TO: Create an ASP.NET HTTP Handler by Using Visual C# .NET
For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
307997HOW TO: Create an ASP.NET HTTP Handler by Using Visual Basic .NET

???

???? ID: 307985 - ????? ???????: 29 ??????? 2010 - ??????: 4.0
???? ???? ???? ??:
  • Microsoft ASP.NET 1.1
  • Microsoft ASP.NET 1.0
??????: 
kbarttyperoadmap kbhttphandlers kbhttpmodule kbhttpruntime kbinfo kbmt KB307985 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:307985

??????????? ???

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com