locked
Question about HttpHandlers path RRS feed

  • Question

  • User338276796 posted

    Hi,all.
    When registering httpHandlers, I can specify a path to match, like this:
     

    <add verb="*" path="*.aspx" type="MyHttpHandler,MyAssembly">

     it can match all the aspx files.

    But, some times I do not want to match all the aspx files, so I put the files that I want to match in a special folder "secure", and change the config like this:

    <add verb="*" path="secure/*.aspx" type="MyHttpHandler,MyAssembly" />
    

     It does well for the *.aspx files under "secure" directory, but it does not work if the file is under the subdirectory of secure. so, if I have to put files in several subdirectories, I have to add the "<add>" configs for each directory. this won't work out if you have many sub directories or if you have dynamic sub directories generated.

    any comments on this ?

    Sunday, March 30, 2008 10:13 PM

Answers

  • User113421904 posted

    Hi, 

    This is because of ASP.NET configuration inheritance; you can find the information here:

    http://msdn.microsoft.com/en-us/library/ms178685.aspx

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 1, 2008 11:13 PM
  • User433598593 posted
    In short:

    1) Create a directory called "secure" in your web app
    2) Stick a web.config in there
    3) Configure an HttpHandler in the new web.config to route ALL ".aspx" requests to your HttpHandler, like in your first example:

    e.g. In ~\secure\web.config:
    <add verb="*" path="*.aspx" type="MyHttpHandler,MyAssembly">
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, January 11, 2009 6:37 PM

All replies

  • User338276796 posted

    no body?

    Sunday, March 30, 2008 10:40 PM
  • User113421904 posted

    Hi, 

    This is because of ASP.NET configuration inheritance; you can find the information here:

    http://msdn.microsoft.com/en-us/library/ms178685.aspx

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 1, 2008 11:13 PM
  • User433598593 posted
    In short:

    1) Create a directory called "secure" in your web app
    2) Stick a web.config in there
    3) Configure an HttpHandler in the new web.config to route ALL ".aspx" requests to your HttpHandler, like in your first example:

    e.g. In ~\secure\web.config:
    <add verb="*" path="*.aspx" type="MyHttpHandler,MyAssembly">
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, January 11, 2009 6:37 PM