SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Learning...
    Join Date
    Jan 2003
    Posts
    781
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MVC3 - Getting the actual page path rather than Route

    I have a route as

    Code:
    http://www.domain.com/Test/12345678
    This points to

    Code:
    http://www.domian.com/SomeArea/SomeController/SomeAction?customerId=12345678
    So, how do i get the actual page path that is currently displaying as

    Code:
    /SomeArea/SomeController/SomeAction


    The beauty of life is not dependent on how happy you are,
    but on how happy others can be because of you...

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,633
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    What is the "actual page path" -- as far as everything is concerned, the route is the path.

  3. #3
    Learning...
    Join Date
    Jan 2003
    Posts
    781
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the route points to /SomeArea/SomeController/SomeAction

    Now the layout also calls some helper actions from inside the /controllers/home to build common pieces.
    The beauty of life is not dependent on how happy you are,
    but on how happy others can be because of you...

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,633
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    First, you have a very bad understanding of routing -- it does not point to a url but rather to specific classes and methods on that class. The default routing URL structure only exists because it is in the default template. You can't just "get the route" like that.

    Anyhow, there are a few ways to skin this beast. The most elegant would be to sue the MVC futures and the Html.RenderAction<T> extensions, that will let you render a specific controller action in a strongly-typed manner. If you can't do that, you can pretty easily pass in the appropriate hashes for route parameters and it will find the controller.

  5. #5
    Learning...
    Join Date
    Jan 2003
    Posts
    781
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I will update as soon as i have some thing in place.
    The beauty of life is not dependent on how happy you are,
    but on how happy others can be because of you...


Bookmarks

Posting Permissions

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