Copied to clipboard

Flag this post as spam?

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


  • Luyolo Mgodi 71 posts 120 karma points
    Aug 25, 2015 @ 20:37
    Luyolo Mgodi
    0

    Umbraco URL REwriting

    Good day,

    I know this issue has been discussed before, but none of these solutions work for me. Can some please tell me if I'm doing anything wrong.

    I have data from a custom source and I need to get data from the database by the id. I have setup my rewrites like below:

     <add name="accommodation_rewrite"
        virtualUrl="^~/accommodation/(.*).aspx"
        rewriteUrlParameter="ExcludeFromClientQueryString"
        destinationUrl="~/accommodation.aspx?accommodationId=$1"
        ignoreCase="true" />
    

    And then I have my Controller like:

        public class AccommodationController : UmbracoController    
        {
           public ActionResult Index(string accommodationId) 
           {
               //do some funky stuff
              return stuff;
            }
         }
    

    However, If I try to navigate to "mysite.com/accommodation/12345" I cannot even hit my controller. I have never done this before, so please any help would really appreciated.

    Thanks, Luyolo

  • Luyolo Mgodi 71 posts 120 karma points
    Aug 27, 2015 @ 11:38
    Luyolo Mgodi
    0

    Anyone had to do something like this before ?

  • Mayank 14 posts 44 karma points
    Aug 27, 2015 @ 11:57
    Mayank
    0

    Hi Luyolo Mgodi,

    I think you can do it using Surface controller

    read query string add pass to the controller via a partial view.

    more about Surface controllers

Please Sign in or register to post replies

Write your reply to:

Draft