Yon*_*ahW 10 asp.net web-config httphandler httpmodule
我想注册一个HttpHandler来包含根文件夹的所有子文件夹,无论它们嵌套多远.我希望使用下面的代码执行此操作,但事实上它只包含直接在根文件夹中的项目.
<httpHandlers>
<add verb="*" path="root/*" type="HandlerType, Assembly" />
</httpHandlers>
Run Code Online (Sandbox Code Playgroud)
我当然可以注册如下,以包含第二层的任何内容,但是还没有找到一种方法来在root下面说出任何东西.
<httpHandlers>
<add verb="*" path="root/*/*" type="HandlerType, Assembly" />
</httpHandlers>
Run Code Online (Sandbox Code Playgroud)
帽子一直困扰着我很长一段时间,我很想听到一个简单的解决方案.
我想澄清的是,当我说"root"时,我并不是指应用程序的根目录,并且不一定有兴趣将应用程序中的所有请求发送到要处理的模块.
Kev*_*ice 21
您不需要单独的web.config.使用主web.config中的<location>元素:
<!-- Configuration for the "root" subdirectory. -->
<location path="root">
<system.web>
<httpHandlers>
<add verb="*" path="root" type="HandlerType, Assembly"/>
</httpHandlers>
</system.web>
</location>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5277 次 |
| 最近记录: |