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>