我用HttpModule实现BS程序权限的控制,另外我用AjaxPro方案实现了Ajax,在Webconfig里,如果我把HttpModuler的注册加上,我的AjaxPro的HttpHandler就不能正常运转了。 这是AjaxPro里的httpHandlers注册 
            <httpHandlers> 
            <add   verb= "POST,GET "   path= "ajaxpro/*.ashx "   type= "AjaxPro.AjaxHandlerFactory,   AjaxPro "/> 
            </httpHandlers>   这是我的HttpModule 
            <httpModules> 
            <add   name= "PaintBusiness.Presentation "   type= "PaintBusiness.Presentation.AppModule,PaintBusiness "   /> 
            </httpModules>     如果在Webconfig中都加上,httpHandler就会出错,Ajax就不能正常运行,去掉HttpModule在WebConfig中的注册,httpHandler就正常了。 请教各位达人,如果使他们共存,多谢,在线等,解决立马给分。

解决方案 »

  1.   

    判断一下扩展名,如果是ashx的话就跳过,或者只处理扩展名为aspx的请求。
      

  2.   

    参考
    http://www.cnblogs.com/xnxylf/archive/2008/12/04/1347676.html
    http://www.cnblogs.com/cuihongyu3503319/archive/2008/12/08/1350624.html
      

  3.   


    void context_BeginRequest(object sender, EventArgs e)
    {
    HttpApplication app = sender as HttpApplication;
    HttpRequest request = app.Context.Request; //Only deal with aspx page
    if (!request.CurrentExecutionFilePath.EndsWith(".aspx", StringComparison.OrdinalIgnoreCase))
    return;        //Deal your things
    }
      

  4.   

    所加的HttpModule本身工作么?即不加ajaxpro是否工作?如果2者单独都是工作的,那么应该是模块里的设置影响了ajaxpro,你都在模块里做什么?是不是需要什么cookie?因为用脚本的话,如果不特别设置,有些cookie是不返回的,参考
    http://www.codinghorror.com/blog/archives/001167.html