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注册时,可以写在第一行,不知道是不是这个原因,我注册时,很长时间不起效。

  • 相关阅读:
    iframe嵌入页面自适应目标页面的高度
    pc端适配
    页面之间传值,接数值
    表单直传文件到七牛
    前端一些小技巧
    css3的一些知识点
    禁止用户长按选中
    修改Html的title值
    判断时间是多久前
    图片裁剪
  • 原文地址:https://www.cnblogs.com/Tpf386/p/15163307.html
Copyright © 2011-2022 走看看