locked
URL-Rewrite with IIS mod rewrite RRS feed

  • Question

  • User-1124928560 posted

    IIS6:
    I've got a small site with the only file called "MySite.aspx".
    But there are lot's of sections in site: /products/, /orders/, /clients/, ...

    My hoster says he has IIS mod rewrite on the server.
    I wrote in my Global.asax:

    protected void Application_BeginRequest(object sender, EventArgs e) 
    {
    Context.RewritePath("/MySite.aspx");
    }

    And this really works:
    User requests mysite.com/xxx.aspx or mysite.com/section/xxx.aspx  and MySite.aspx runs instead. Great!
    But in case a user requests URL like mysite.com/xxx/ he sees error 404. (And I want MySite.aspx run instead)

    What sholud I do?
    Maybe I should add something to my web.config?

    Thank you.

     

    Wednesday, August 12, 2009 5:45 AM

Answers

  • User1763172376 posted

    use open source free http://urlrewriter.net/

    and example is here,

    http://dotnetguts.blogspot.com/2008/07/url-rewriting-with-urlrewriternet.html

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 15, 2009 5:35 AM