Previous Next

Thread: IHttpHandlerFactory not working with url extension *.aspx

Last post 03-16-2007 3:29 PM by anilr. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 03-14-2007, 9:35 AM

    IHttpHandlerFactory not working with url extension *.aspx

    Hi everybody,

    We have a problem regarding an registered IHttpHandlerFactory not working wiht Urls with aspx extension.

     This is our config.entry: 

    <httpHandlers>
    <
    remove verb="*" path="factory.ashx" />
    <
    add verb="*" path="factory.ashx" type="TestApplication.HandlerFactory" />
    </httpHandlers>

    This is an  IHttpHandlerFactory which assigns the appropriate IHttpHandler (our own) for the request processing regarding certain Url stuff.

    An Url for that could/would look like:
    http://localhost/factory.ashx/folder/document.aspx

    *The reason that we add the aspx to our (generated) urls is to provide the right MimeType for any client whch recognizes it by the url extension.

    This worked well with IIS6. Whenever the URl contained the "factory.ashx", the request was send through the IHttpHandlerFactory and then processe by one of our IHttpHandlers.

    In IIS this has stopped working!
    As soon as the Url has the "aspx" extension, the request is not send throught the factory anymore, and thus IIS returns 404 because it doesnt find a physical file for that Url.

    Does anybody have an idea, how to solve that (by certain settings either in IIS website or in web.config)?! 

    Otherwize the only solution would be that we dont add aspx to our Urls. But while we would like to provide an extension, we might need to go to html extension instead.

    best regards
    H.Polenz

     

     

     

  • 03-16-2007, 1:34 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 905
    • anilr

    Re: IHttpHandlerFactory not working with url extension *.aspx

    You need to move this configuration to system.webServer/handlers section for integrated mode - if you want to have configuration which works in both integrated and classic mode, it will look like this

    <configuration>
      <system.web>
        <httpHandlers>
          <add verb="*" path="factory.ashx" type="TestApplication.HandlerFactory" />
        </httpHandlers>
      </system.web>

      <system.webServer>
        <handlers>
          <add name="Factory-ashx-Integrated" verb="*" path="factory.ashx" type="TestApplication.HandlerFactory" preCondition="integratedMode" />
        </handlers>
        <validation validateIntegratedModeConfiguration="false" />
      </system.webServer>
    </configuration>

    -Anil

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 03-16-2007, 3:22 PM In reply to

    Re: IHttpHandlerFactory not working with url extension *.aspx

    Thanks Anil, :-)

    nut besides the IntegratedMode it also does not work with my web app running in the Classic .Net pool ?!
    Is there a similar webServer config entry to set for?!

    regards
    Heiko

  • 03-16-2007, 3:29 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 905
    • anilr

    Re: IHttpHandlerFactory not working with url extension *.aspx

    For classic mode, you may have to make sure that the SimpleHandlerFactory-ISAPI-2.0 entry in the handlers list appears above the PageHandlerFactory-ISAPI-2.0 entry - the order would determine whether IIS considers the .ashx or .aspx to be the extension to break the path at - and that may determine how asp.net is doing the httpHandlers mapping (although, even is IIS breaks the path at .aspx below, as long as your factory.ashx setting is at the top of the httpHandlers list, that should take precedence over the *.aspx httpHandlers entry).

    -Anil

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
Page 1 of 1 (4 items)
Page view counter