031-一般处理程序重用

HtmlPage.html

 1 <!DOCTYPE html>
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5     <title></title>
 6 </head>
 7 <body>
 8     <a href="Index.ashx">Index.ashx</a>
 9     <hr />
10     <a href="hello.do">hello</a>
11     <a href="xlb.do">xlb</a>
12     <a href="yg.do">yg</a>
13 </body>
14 </html>

Index.ashx

 1     public class Index : IHttpHandler
 2     {
 3         private int p = 1;
 4         public void ProcessRequest(HttpContext context)
 5         {
 6             context.Response.ContentType = "text/plain";
 7             p++;
 8             context.Response.Write(p);
 9         }
10 
11         public bool IsReusable
12         {
13             get
14             {
15                 return false;
16             }
17         }
18     }

Web.config

 1 <?xml version="1.0" encoding="utf-8"?>
 2 
 3 <!--
 4   有关如何配置 ASP.NET 应用程序的详细信息,请访问
 5   http://go.microsoft.com/fwlink/?LinkId=169433
 6   -->
 7 
 8 <configuration>
 9   <system.web>
10     <compilation debug="true" targetFramework="4.5" />
11     <httpRuntime targetFramework="4.5" />
12   </system.web>
13   <system.webServer>
14     <handlers>
15       <add name="DoHandler" path="*.do" verb="*" type="t6_Reusable.Index" />
16     </handlers>
17   </system.webServer>
18 </configuration>

 

转载于:https://www.cnblogs.com/ninghongkun/p/6368999.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值