日期:2014-05-17  浏览次数:20503 次

HttpHandlers怎么接管所有请求?
就是例如/aaa/aaa/aaaa/aaa/aa.xxx能
/aa/aa/aa能
/as.xxx?sss=sss&ss=ss 能
/sdf.xxx 能
反正一切请求都能,怎么配置??急!!!!!!!!

------解决方案--------------------
这个要在Global.asax全局应用程序类中Request_Begin中写控制,来捕获用户每一个http请求。
------解决方案--------------------
webconfig中
<httpHandlers>
<add verb="*" path="trace.axd" type="System.Web.Handlers.TraceHandler"/>
 
 <add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory"/>

其实要所有请求的话还是httpmodul适合些
------解决方案--------------------
http://www.cnblogs.com/basibasi/archive/2008/02/16/1070895.html
------解决方案--------------------
<add verb="*" path="*.*" type="自定义handler的命名空间"/> 

我猜的 没有测试过 谁测试下 呵呵 不知道这样能不能处理所有的请求


探讨

webconfig中
<httpHandlers>
<add verb="*" path="trace.axd" type="System.Web.Handlers.TraceHandler"/>

<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory"/>

其实要所有请求的话还是httpmodul……

------解决方案--------------------
探讨

webconfig中
<httpHandlers>
<add verb="*" path="trace.axd" type="System.Web.Handlers.TraceHandler"/>

<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory"/>

其实要所有请求的话还是httpmodul……

------解决方案--------------------


引用:

楼主 你把我水了哈 今晚有兴趣测试了下 完全是可以处理所有请求的 呵呵
C# code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsumerManage.Common
{
    public class httpHandler : System.Web.IHttpHandler
    {
        #region IHttpHandler 成员

        public bool IsReusable
        {
            get { return false; }
        }

        public void ProcessRequest(System.Web.HttpContext context)
        {
            context.Response.Write("擦");
        }

        #endregion
    }
}