Copied to clipboard

Flag this post as spam?

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

  • Saied 349 posts 674 karma points
    Sep 21, 2015 @ 19:01

    RedirectToCurrentUmbracoPage() removes my query string?

    When I go to the following page:


    There is a Buy Now button which makes a POST and updates a database. The problem is when I call RedirectToCurrentUmbracoPage, it redirects to http://localhost/products/product and complains that it is looking for a ProductViewModel, but I am passing it a RenderModel.

    Product is just a placeholder in my site structure to hold virtual nodes and the part after product /23/red-crayon is part of a custom route. When I do a redirect, I would like to stay on the page with the query string. Is there a way to do it with RedirectToCurrentUmbracoPage (It does seem like this would redirect to /products/product since I am actually on a products page)

    I have tried RedirectToCurrentUmbracoUrl and this does redirect to the current page with the url, but I wasn't sure if this was the correct way?

  • Carl Jackson 139 posts 478 karma points
    Sep 22, 2015 @ 13:22
    Carl Jackson

    RedirectToCurrentUmbracoPage takes a string for queryString which I imagine will get you to where you want to go but maybe just not with the clean URL.

    Alternatively you should be able to return new RedirectResult("/url"); and build the URL yourself?



  • Saied 349 posts 674 karma points
    Sep 22, 2015 @ 13:26


    So is RedirectToCurrentUmbracoUrl the same as RedirectResult(/url)?

  • Nicolai Christiansen 4 posts 96 karma points
    Nov 28, 2018 @ 10:27
    Nicolai Christiansen

    Some years later..

    try this

    RedirectToCurrentUmbracoPage("?id=" + MyId);

    this will redirect with the desired query string

  • baile185 2 posts 22 karma points
    Aug 19, 2020 @ 17:33

    FYI, I tried it without the "?" and it worked fine. Example:

    RedirectToCurrentUmbracoPage("id=" + MyId);

Please Sign in or register to post replies

Write your reply to: