Copied to clipboard

Flag this post as spam?

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


  • BaconBeastNz 40 posts 60 karma points
    Mar 26, 2012 @ 07:32
    BaconBeastNz
    0

    How to process this request with Umbraco?

    Hi!

    I have a page /users/view , that I want to show specific user profiles. I want the URL for the user to show as:

    /users/12345/hisusername (where 12345 is his user id).

    For the moment to get the ball rolling I've tried just going to /users/view/12345/hisusername of course that tries to find a page rather than go to users/view with request parameters.

    How can I go about this?

  • Michael Latouche 504 posts 819 karma points MVP 4x c-trib
    Mar 26, 2012 @ 09:44
    Michael Latouche
    0

    Hello,

    Normally you should be able to define a route for this in the config files. Can you maybe specify on which version of Umbraco you are working?

    Cheers,

    Michael.

  • Mike Chambers 636 posts 1253 karma points c-trib
    Mar 26, 2012 @ 10:43
    Mike Chambers
    0

    If it's not an imbuilt config setting... then you could always create you own template with macro to display the correct data... and use the urlrewriting.config to rewrite you required url into the physical url + get paramaters.

    Here's the actual comment from the \config\urlrewriting.config

    Urlrewriting.Net is a cool tool, what can make your urls look nice.
    The rewriting is controlled with regular expressions. To get more help
    look at http://www.urlrewriting.net/. 
    
    Remember to read the manual! 
    http://umbraco.org/redir/urlRewritingManual
    
    The sample below rewrites a url from 
    "/product/someproductid.aspx" to 
    "/product.aspx?productid=someproductid" 
    
    The user will not see the rewritten path! The page that will be 
    loaded from umbraco will instead be:
    "/product.aspx?productid=someproductid" 
    
    {add name="produktidrewrite" 
        virtualUrl="^~/product/(.*).aspx" 
        rewriteUrlParameter="ExcludeFromClientQueryString" 
        destinationUrl="~/product.aspx?productid=$1" 
        ignoreCase="true" /}
    
    This sample is usefull for a productpage, where the product comes from a 
    dynamic datasource, e.g. a database. The querystring "productid" can be loaded
    from the template, into a macro, that then loads the product!
    
    Any bugs or problems with the rewriter, contact Anders/Duckie

    from that you  can rewrite /users/12345/hisusername to yourProfileview.aspx?id=12345

    something like

    {add name="produktidrewrite"  virtualUrl="^~/users/([\d]*)/.*.aspx"  rewriteUrlParameter="ExcludeFromClientQueryString"  destinationUrl="~/profileView.aspx?userid=$1"  ignoreCase="true" /}

Please Sign in or register to post replies

Write your reply to:

Draft