zoukankan      html  css  js  c++  java
  • 自定义HttpHandler或HttpModule处理图片注意事项

    自定义HttpHandler时,有时候怎么配置都不起效,这里记录下:

    自定义完HttpHandler或HttpModule后需要再web.config中进行注册。

    注册HttpHandler在节点  <system.webServer>下:

     <handlers>
          <remove name="WebServiceHandlerFactory-Integrated"/>
          <remove name="ScriptHandlerFactory"/>
          <remove name="ScriptHandlerFactoryAppServices"/>
          <remove name="ScriptResource"/>
          <!--自定义handler-->
          <add name="pngFileHandler" path="File/*.png" verb="*" type="TestDownloadIntercept.MyHandler.MyFileHandler,TestDownloadIntercept"/>
          <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </handlers>

    注册HttpModule,在节点<system.webServer>下面:

      <modules>
          <remove name="ScriptModule"/>
          <add name="MyFileModule" type="TestDownloadIntercept.MyModule.MyFileModule,TestDownloadIntercept"/>
          <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </modules>

    在webconfig注册时,可以写在第一行,不知道是不是这个原因,我注册时,很长时间不起效。

  • 相关阅读:
    java.lang.NoSuchMethodError: org.json.JSONArray.iterator()Ljava/util/Iterator 阿里云短信
    iframe高度自适应
    jQuery中的事件——《锋利的JQuery》
    jQuery中的DOM操作——《锋利的JQuery》
    JQuery选择器——《锋利的JQuery》
    JS的从理解对象到创建对象
    JS键盘事件对象之keyCode、charCode、which属性对比
    JS事件及其兼容用法
    JS中函数参数值传递和引用传递
    JS之DOM那些事
  • 原文地址:https://www.cnblogs.com/Tpf386/p/15163307.html
Copyright © 2011-2022 走看看