• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
灬伊天?
博客园    首页    新随笔    联系   管理    订阅  订阅

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>

 

posted @ 2017-02-06 01:50  灬伊天☂  阅读(149)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3