about IHttpHandler





获取一个值,该值指示其他请求是否可以使用 IHttpHandler 实例。








































本例中:客户端(浏览器)对handler.aspx的请求均由包含在程序集 HandlerTest.dll 中的命名空间 HandlerExample 中的 MyHttpHandler 类提供服务,所以尽管handler.aspx页面内没有内容,还是能在该页面被请求时显示内容,完全是HandlerTest.dll在处理浏览器对handler.aspx请求,HandlerTest.dll 决定了要返回给浏览器什么样的,什么内容。
事实上即使handler.aspx中有aspbutton等等也完全不会被理会,根本在浏览器中得不到显示。
本例中:
default.aspx中在浏览器端的“源代码”:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
zzz <div>
<hr />
<a id="HyperLink1" href="fold1/handler.aspx">redirect to handler.aspx</a>
</div>
</form>
</body>
</html>
****************************************************
而handler.aspx在浏览器端的源代码:
<H1>This is an HttpHandler Test.</H1><p>Your Browser:</p>Type: IE6<br>Version: 6.0
****************************************************
这样是不是会增加“效率”????
1.// Name this C# file HandlerTest.cs and compile it with the
// command line: csc /t:library /r:System.Web.dll HandlerTest.cs.
// Copy HandlerTest.dll to your \bin directory.
2.To use this handler, include the following lines in a Web.config file.
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="handler.aspx" type="HandlerExample.MyHttpHandler,HandlerTest"/>
</httpHandlers>
</system.web>
</configuration>
*/
testIHttpHandler