www.webdeveloper.com
Results 1 to 4 of 4

Thread: Dynamic Url Routing

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Posts
    73

    Post Dynamic Url Routing

    How can I use the following url structure:

    /{category_level1}/{category_level2}/{category_level3}/{category_level_n}

    Where the structure is based on navigating down a hierarchy stored in a database and a user can remove a category level from the path to move back up the hierarchy.

    I want to use this structure for an eCommerce site with the following example url:

    /electrical/televisions/sony+bravia+40+inch+1080p/

    Where removing /sony+bravia+40+inch+1080p/ would call a controller and action for listing electrical/televisions.

    Not sure whether to use MVC2 Routing, Url rewriting etc.

  2. #2
    Join Date
    Jan 2007
    Location
    Wisconsin
    Posts
    2,120
    Sounds like URL rewriting would be best. It should be fairly easy to rewrite something like ...

    Code:
    /nav/a/b/c/ -> /nav.aspx?location=a/b/c
    So, if you're using .NET's interface, you can either use the "User friendly URL's" wizard, or manually set up a rule with the Match URL -> Pattern [using regular expressions] like ...

    Code:
    ^nav/([^/]+)/?$
    And an Action -> Rewrite -> Rewrite URL like ...

    Code:
    nav.aspx?location={R:1}
    Then have nav.aspx break the location GET variable apart on the slashes and process accordingly.
    Jon Wire

    thepointless.com | rounded corner generator

    I agree with Apple. Flash is just terrible.

    Use CODE tags!

  3. #3
    Join Date
    Jun 2007
    Posts
    73
    Thanks for the reply.

    Just wondered how I can locate a specific url from non-specific data e.g. gucci/guilty/30ml-perfume-gift-set

    Do I need to include a unique id somewhere or is there something else I can do to use this non-specific data to look up the unique id.

    I would prefer to use MVC2 framework. Can I use URL rewriting with MVC2 to call a controller and an action with some parameters?

    Kind regards,

    John Askew

  4. #4
    Join Date
    Jan 2011
    Posts
    6
    Hi Vouzamo and Svidgen,
    I am looking for a Software Developer in Illinois for a full time position at our company. Do either of you guys know of anyone looking for a company change in Illinois? I would appreciate any leads, thank you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles