Mapping specific folder to HttpHandler in web.config

前端 未结 3 2133
攒了一身酷
攒了一身酷 2021-01-05 04:04

Is it possible to map all file extensions in a folder to a specific HttpHandler (assuming that their file extensions are mapped to aspnet_isapi.dll in IIS) ?

I\'ve g

相关标签:
3条回答
  • 2021-01-05 04:35

    Here is a diffrent way that doesn't require a "dummy" folder and and a new web.config.

    Add this to your main web.config

    <location path="static">
      <system.web>
        <httpHandlers>
          <add verb="GET,HEAD" path="*.*" 
               type="MyApp.PassthroughFileHandler, MyApp" />
        </httpHandlers>
      </system.web>    
    </location>
    
    0 讨论(0)
  • 2021-01-05 04:49

    Try placing a second web.config inside that folder, with something like:

    <?xml version="1.0"?>
    <configuration>
        <system.web>
          <httpHandlers>
            <!-- <clear/> -->
            <add verb="*" path="*.flv"
                type="WebApplication3.MyHandler, WebApplication3"/>
          </httpHandlers>
        </system.web>
    </configuration>
    
    0 讨论(0)
  • 2021-01-05 04:50

    I think you need to go into IIS (I assume you're using II 6) and configure ASP.NET to handle wildcard extensions. Because although you've mapped the .flv extension, IIS will handle Static/Index.htm normally and not pass it to ASP.NET.

    http://professionalaspnet.com/archive/2007/07/27/Configure-IIS-for-Wildcard-Extensions-in-ASP.NET.aspx

    You can probably configure IIS for just this static folder, though I've never tried this.

    0 讨论(0)
提交回复
热议问题