Configuration and use of. NET httphandlers

Source: Internet
Author: User

HttpHandler is where ASP. NET really handles HTTP requests. In this HttpHandler container, the ASP is actually compiling and executing the server page requested by the client and appending the processed information back to HttpModule in the HTTP request stream.


Because the version differs from the configured node location

This is the official configuration node.

Https://msdn.microsoft.com/zh-cn/library/7d6sws33 (v=vs.80). aspx


Found in the use of version 4.5

The actual node is as follows

<configuration>

<system.webServer>

<add name= "Prolist" verb= "*" path= "Proinfo" type= "Mall.prolist,mall"/>



</system.webServer>

</configuration>

Proinfo: Is the address name can be customized configuration

http://localhost:8361/prolist?pageindex=2&pagecount=1&queryparameters={%22proname%22:%22a%22}& parametersign=360a9ba188a2b0e7217f018c4985e89b



A simple IHttpHandler.

First: Define a class that implements the IHttpHandler, and implement its ProcessRequest method. In a HttpHandler container if you need to access the session, you must implement the IRequiresSessionState interface, which is just a token interface and there is no method.

usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingsystem.web;

namespaceMyhttphandler
{
PublicclassHellohttphandler:ihttphandler
{
PublicBOOLIsReusable
{
Get{returntrue; }
}

PublicvoidProcessRequest (HttpContext context)
{
Context. Response.Write ("Hellohttphandler Processing");
}
}
}
<add name= "Proinfo" verb= "*" path= "Proinfo" type= "Myhttphandler. Hellohttphandler,myhttphandler "/>
Http://localhost:8361/proinfo

Configuration and use of. NET httphandlers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.