在web.config中映射特定的文件夹到的HttpHandler [英] Mapping specific folder to HttpHandler in web.config

查看:223
本文介绍了在web.config中映射特定的文件夹到的HttpHandler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能到一个文件夹到一个特定的HttpHandler中的所有文件的扩展名映射(假设他们的文件扩展名映射在IIS中ASPNET_ISAPI.DLL)?

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) ?

我已经得到了扩展FLV在IIS中映射到ASP.NET,并有一个文件夹命名的静态的符合下列文件我的Web应用程序:

I've got the FLV extension mapped to ASP.NET in IIS, and have a folder named Static in my web application with the following files:


  • 静态/ index.htm的

  • 静态/ MyFile.flv

索引文件是使用 JW FLV媒体播放器来播放FLV一个基本的HTML页面

The index file is a basic html page using the JW FLV Media Player to play the FLV.

在Web.Config中,下HttpHanders部分,下面的工程(FLV已加载,并且成功地扮演):

In Web.Config, under the HttpHanders section, the following works (FLV is loaded and plays successfully):

<add verb="*" path="MyFile.flv" type="MyApp.PassthroughFileHandler, MyApp"/>

但是,这并不(视频无法加载):

But this doesn't (video cannot be loaded):

<add verb="*" path="Static/*" type="MyApp.PassthroughFileHandler, MyApp"/>

我已经试过各种组合,没有多少运气。

I've tried various combinations, without much luck.

在理想情况下,我想能有所有FLV的静态文件夹使用PassthroughFileHandler,而不是要在web.config中分别指定每个文件名。

Ideally, I'd like to be able to have all FLV's in the Static folder use the PassthroughFileHandler, rather than have to specify each filename individually in web.config.

推荐答案

尝试将第二的web.config文件夹内,喜欢的东西:

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>

这篇关于在web.config中映射特定的文件夹到的HttpHandler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆