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

  • 相关阅读:
    Django ORM多表操作
    Django 单表查询作业-笔记
    python 2 编码问题
    HTML-Bootstrap下载和基本使用
    Django ORM单表操作之增删改查
    Django ORM简介和单表创建的设置和过程
    Django --总结 之URL路由控制 视图相应,视图请求,和模板语法
    Django URL控制器
    JAVA编程
    UMI 的原理分析带有 UMI 的数据
  • 原文地址:https://www.cnblogs.com/Tpf386/p/15163307.html
Copyright © 2011-2022 走看看