Best way to display partial view with message following RedirectToCurrentUmbracoPage()
Hi all,
I am currently on the final stages of developing a one stage booking process where:
The user enters their information including card details
The details are processed and passed off to a third party payment system using web services
The results of the payment request are returned
Upon failure, I use CurrentUmbracoPage() to allow the user to resubmit and amend some of their details
Upon success, I want to redirect the user away (so they cannot click refresh and pay again) but also display either a new view or alternate template with a confirmation message and receipt.
It is the sucess bit I am struggling with. I have tried the following:
RedirectToAction("Confirmation")
which utilises
public ActionResult Confirmation() {
return View("Confirmation")
}
The problem with this is it redirects to a horrible looking url like:
I've also tried using RedirectToCurrentUmbracoPage() passing in a querystring but this again looks messy with the alttemplate querystring in place. Ideally, if I could use the other form of alttemplate where I just append the alternate template name to the end of the url, that would be perfect but I have not yet found a way of doing that.
Can anyone advise what would be best here? My preference would be to still display the same URL but render a different view that shows the confirmation information with a button that allows the user to go back to the original version of the page.
Any hints or tips would be greatly appreciated as my base MVC knowledge still isn't too strong.
I think from the scenario you are describing you could just return a redirect result, with your altTemplate name appended; in the format you prefer;
eg:
var currentPageUrl = CurrentPage.Url + "/altTemplateAlias";
return Redirect(currentPageUrl);
The other approach would be to set a flag in the TempData dictionary, which will survive the RedirectToCurrentUmbracoPage() and then in your existing partial check for the existence of the flag and render something different.
Is this the standard convention that is supposed to be used in MVC though? I've used this method before but I'm sure there is something that is more robust out there. I can't believe that you cannot just render an alternative view on the same page to display different content but that thanks for the response.
Best way to display partial view with message following RedirectToCurrentUmbracoPage()
Hi all,
I am currently on the final stages of developing a one stage booking process where:
The user enters their information including card details
The details are processed and passed off to a third party payment system using web services
The results of the payment request are returned
Upon failure, I use CurrentUmbracoPage() to allow the user to resubmit and amend some of their details
Upon success, I want to redirect the user away (so they cannot click refresh and pay again) but also display either a new view or alternate template with a confirmation message and receipt.
It is the sucess bit I am struggling with. I have tried the following:
which utilises
The problem with this is it redirects to a horrible looking url like:
instead of the actual page I was on:
http://localhost:54293/tours/this-tour-is-a-test
I've also tried using RedirectToCurrentUmbracoPage() passing in a querystring but this again looks messy with the alttemplate querystring in place. Ideally, if I could use the other form of alttemplate where I just append the alternate template name to the end of the url, that would be perfect but I have not yet found a way of doing that.
Can anyone advise what would be best here? My preference would be to still display the same URL but render a different view that shows the confirmation information with a button that allows the user to go back to the original version of the page.
Any hints or tips would be greatly appreciated as my base MVC knowledge still isn't too strong.
Cheers,
Jason
Hi Jason
I think from the scenario you are describing you could just return a redirect result, with your altTemplate name appended; in the format you prefer;
eg:
The other approach would be to set a flag in the TempData dictionary, which will survive the RedirectToCurrentUmbracoPage() and then in your existing partial check for the existence of the flag and render something different.
eg.
and then in your partial have a check:
regards
Marc
Is this the standard convention that is supposed to be used in MVC though? I've used this method before but I'm sure there is something that is more robust out there. I can't believe that you cannot just render an alternative view on the same page to display different content but that thanks for the response.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.