Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

urlMapping not working (Asp.Net 2 & IIS 6)

Options
  • 13-07-2007 10:40am
    #1
    Registered Users Posts: 7,468 ✭✭✭


    [HTML]
    <urlMappings enabled="true">
    <add url="~/Public/Product/Electronics/" mappedUrl="~/Public/ProductCategory.aspx?i=1"/>
    </urlMappings>
    [/HTML]


    I have the above in my web.config file. It works fine from VS2005's dev server but when we publish the site to IIS it returns a 404 error code. I've tested the un-rewritten url (~/Public/ProductCategory.aspx?i=1) and it works fine. Anybody have any ideas? I'm stumped and can't find a solution.


Comments

  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    It would appear that IIS doesn't like the lack of file extension on ~/Public/Product/Electronics/. I will continue to dig.


  • Closed Accounts Posts: 120 ✭✭samelterrance


    Hi Phil,

    Are you allowed that extension in your IIS settings.
    If you go to properties and go to configuration. Add an extention of .*.

    Maybe you've already tried it.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Yeah I just found that, thanks. The problem with wildcard mapping is that every request gets sent to Asp.Net which is less than ideal. We could also just map to ~/Public/Product/Electronics.aspx which will also work but we loose our cool looking URL.

    I'm going to see if I can come up with a third solution.


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    Could there be something on the IIS site already that's interfering with it's behaviour like an ISAPI filter or a HTTPModule or something ?


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    We do have a couple of custom httpmodules running alright but it seems that IIS won't send extensionless requests to Asp.net unless it's configured to (using samelterrance's solution above). Where as VS 2005's dev server processing ever request as Asp.net hence we don't have the problem in our dev environments.


  • Advertisement
  • Closed Accounts Posts: 120 ✭✭samelterrance


    Phil,
    Just found this if it's of any use.

    What does IIS do with paths that have no extension, like /bestpayroll/msdnmag/report? IIS checks to see if the virtual path maps to an existing physical directory. If it does, it looks up the list of the default documents to find a match with a name in the list of the default documents. If it finds one, it redirects the client to this file as I explained earlier. Otherwise it simply reports an HTTP 404—File not found error.


  • Registered Users Posts: 437 ✭✭Spunj


    Phil have a look at this handy open source component, I use it myself and it simplifies rewriting a lot for me.

    http://www.urlrewriting.net/en/Default.aspx


Advertisement