在web.config中的配置
   <httpModules>
      <add name="myModule" type="MyWeb.MyModule" />
    </httpModules>可以在配置文件中加只拦截*.aspx的限制吗??
还是只可以在MyModule中处理?????   private void context_AcquireRequestState(object sender, EventArgs e)
   {
       HttpApplication application = sender as HttpApplication;
        HttpRequest request = application.Request;
        HttpResponse response = application.Response;        string uri = request.RawUrl;        string a= uri.Substring(uri.LastIndexOf(".") + 1);        //只拦截aspx页面
        if (a.Contains("aspx"))
        {
            //处理
        }
   }

解决方案 »

  1.   

    实现IhttpHandler接口 根据Request.UrlReferr判断后缀名是否有aspx
      

  2.   

    httpmodule只是负责过滤
    httphandle负责处理
    如果要过来aspx页面,要用httpmodule
      

  3.   

    public void ProcessRequest(HttpContext context)
            {
               string FileName = context.Server.MapPath(context.Request.FilePath);
               if (context.Request.UrlReferrer.Host == null){}
               else
               {  
                  if (context.Request.UrlReferrer.Host.Contains(""))
                    {
                  }
               }
            }
            public bool IsReusable
            {
                get { return true; }
            }
      

  4.   

    这个过滤aspx是默认的你想不让他过滤什么
      

  5.   


    如果是1.aspx上的图片 *.jpg,链接a.htm。触发的时候都会被过滤如何屏蔽?
      

  6.   

    <httpModules>
          <add name="myModule" path="*.aspx" type="MyWeb.MyModule" />
        </httpModules>
      

  7.   


    *.jpg等这些文件默认由iis直接处理,用不着使用自定义httpmodule过滤。如果使用vs内置web服务器,则所有请求都会经过所有的httpmodule由aspnet_isapi.dll处理。
      

  8.   

    默认情况,IIS不会把jpg请求交给asp.net运行时,过滤也没用
      

  9.   


    它没有path属性,硬写会报错!
      

  10.   

    在配置文件里指定aspx请求  path="*.aspx" 见7楼老大!
      

  11.   


    它没有path属性,硬写会报错!
      

  12.   

    去配置节的 httphanlder节点配置,然后继承Ihttphanlder接口,实现ProcessRequest方法试试httphanlder配置节点应该有path属性
      

  13.   

    7楼老大的你改为<httpHandlers><addname="myModule" path="*.aspx" type="MyWeb.MyModule"/></httpHandlers>
      

  14.   

    请求aspx页面时,也会请求相关的css文件,也会被过滤所以只过滤aspx页面的话还要判断下