I use a custom HttpHandler in .NET for all *.html
files, however I want to create a single exception for the file foo.html
, which should be handled as a static file on the hard drive. I've tried:
<httpHandlers>
<remove verb="*" path="*.html" />
<add verb="*" path="/foo.html" type="System.Web.StaticFileHandler" />
<add verb="*" path="*.html" validate="false" type="Imp.Handler" />
</httpHandlers>
As well as:
<httpHandlers>
<remove verb="*" path="*.html" />
<add verb="*" path="*.html" validate="false" type="Imp.Handler" />
<add verb="*" path="/foo.html" type="System.Web.StaticFileHandler" />
</httpHandlers>
However, both will cause Imp.Handler to handle foo.html
requests still. What am I doing wrong?
IIS is running in Classic mode.
may be this method can help you,move the files to the other folder and disable httphandler for this folder.
<location allowOverride="false" path="Static">
<system.web>
<httpHandlers>
<remove verb="*" path="*.htm"/>
<!--<add verb="*" path="/foo.htm" type="System.Web.StaticFileHandler" />-->
</httpHandlers>
</system.web>
</location>
<httpHandlers>
<add verb="*" path="*.html" validate="false" type="Imp.Handler" />
</httpHandlers>
i trying test this,the question is :
if i remove HttpHandler for the "*.html" in the location element,and add a other httphandler will doesn't worked
.for example:
<location>
<remove verb="*" path="*.htm"/>
<add verb="*" path="foo.html" validate="false" type="Imp.Handler" />
</location>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.