Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dan White 206 posts 510 karma points c-trib
    Jan 16, 2013 @ 22:39
    Dan White
    0

    Complex Routing question

    Look for some really smart people to help me solve a routing problem

    How would I turn 

    site.com/page/?x=foo

    to 

    site.com/page/foo

    Where "page" is not a static url segment name or path.

    Everything I've read in regard to MVC routing and URL rewriting would require a static segment name or path in the url.

    Thanks!

  • Niels Jorck Ellegaard 39 posts 245 karma points
    Jan 22, 2013 @ 14:20
    Niels Jorck Ellegaard
    0

    As long as the querystring variable is static, this should be possible with URL rewrite.

     

            <rule name="Routing Example" stopProcessing="true">
              <match url="(.*)" />
              <conditions>
                <add input="{QUERY_STRING}" pattern="x=(.+)" negate="true" />
              </conditions>
              <action type="Redirect" redirectType="Permanent" url="{HTTP_HOST}{REQUEST_URI}{C:1}" />
            </rule>

    I'm not 100% sure this answers your question or fit your need. If not you have to elaborate so I'm better able to help :)

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies