Dynamic Routing

Last post 04-13-2009 8:22 AM by sjnaughton. 2 replies.

Sort Posts:

  • Dynamic Routing

    04-13-2009, 3:30 AM
    • Member
      point Member
    • arkadikr81
    • Member since 04-13-2009, 7:25 AM
    • Posts 1

    Hi.

    How can I know in what PageAction mode I'm currently working, Tryed to get it from RouteData without success.

    Any solutions ???

     

  • Re: Dynamic Routing

    04-13-2009, 4:10 AM
    • Star
      12,272 point Star
    • sjnaughton
    • Member since 04-29-2008, 1:11 PM
    • Newton-le-Willows, Merseyside, UK
    • Posts 2,559
    • TrustedFriends-MVPs

    What I did was: 

    public static String GetPageAction(this HttpRequest request)
    {
        String path = request.Path;
        var qs = path.Substring(path.LastIndexOf("/") + 1, path.Length - (path.LastIndexOf("/") + 6));
    
        return qs;
    }
    

     Which just get the page name out of the path I don'y know it this is any use to you as it will not give you anything if usfull if you have custome routes and pages with names that don't match the action Sad

     

    Steve Big Smile

    Always seeking an elegant solution.
    [Oh! If olny I colud tpye!]
    c# Bits blog
    Oh, and don't forget to mark as answer any posts that help you Big Smile
  • Re: Dynamic Routing

    04-13-2009, 8:22 AM
    • Star
      12,272 point Star
    • sjnaughton
    • Member since 04-29-2008, 1:11 PM
    • Newton-le-Willows, Merseyside, UK
    • Posts 2,559
    • TrustedFriends-MVPs

    Have a look at this util from ASP.NET Routing Debugger from Phil Haack's blog hr mentioned it a t mix09 Big Smile

    Steve Big Smile

    Always seeking an elegant solution.
    [Oh! If olny I colud tpye!]
    c# Bits blog
    Oh, and don't forget to mark as answer any posts that help you Big Smile
Page 1 of 1 (3 items)