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?
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?
RedirectToCurrentUmbracoPage() removes my query string?
When I go to the following page:
http://localhost/Products/Product/23/red-crayon
There is a
Buy Now
button which makes a POST and updates a database. The problem is when I callRedirectToCurrentUmbracoPage
, it redirects tohttp://localhost/products/product
and complains that it is looking for aProductViewModel
, but I am passing it aRenderModel
.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 withRedirectToCurrentUmbracoPage
(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?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?
Thanks
Carl
Hi,
So is
RedirectToCurrentUmbracoUrl
the same asRedirectResult(/url)
?Some years later..
try this
RedirectToCurrentUmbracoPage("?id=" + MyId);
this will redirect with the desired query string
FYI, I tried it without the "?" and it worked fine. Example:
RedirectToCurrentUmbracoPage("id=" + MyId);
is working on a reply...