URL rewriting and web.config

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shinobi
    New Member
    • Nov 2008
    • 7

    URL rewriting and web.config

    I am using ASP.net(c#) for my project. In my my project 2 pages are using URL rewriting method by referring this article

    URL Rewriting using Intelligencia UrlRewriter Example 1 - Blog Day Afternoon

    from my form i used this code.
    Response.Redire ct("showdetail s/" + a);

    in my Web.config
    [code=xml]
    <system.webServ er>
    <modules runAllManagedMo dulesForAllRequ ests="true">
    <add name="UrlRewrit er" type="Intellige ncia.UrlRewrite r.RewriterHttpM odule"/>
    </modules>
    <validation validateIntegra tedModeConfigur ation="false"/>
    </system.webServe r>
    <rewriter>
    <rewrite url="~/showdetails/(.+)" to="~/details.aspx?id =$1" permanent="true "/>
    </rewriter>[/code]
    these are the code i used.
    this code rewrite my url like this
    example

    But i wantto remove that "showdetail s" part from url and.
    create a valid url like this
    example
    if i copy paste this link into address bar it must work.
    If i remove that string, then other pages(Normal pages ending with extension
    like index.aspx) they got error.

    can i check extension in web.config.? Or is there is any other way for url rewriting?

    Please help me...
    Last edited by Frinavale; Dec 30 '08, 02:27 PM. Reason: added [code] tags
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Have you tried adding rewrite entries for the regular pages as well?
    Since you are removing the "showdetail s" from the URL, the server still needs to be able to map to the files in the "showdetail s" directory...whi ch means you have to map to the files that you want to use.

    Comment

    Working...