c# - Post/Redirect/Get Pattern in ASP.NET MVC -
What is the best practice to implement post / redirect / gate pattern in ASP.NET MVC?
- Specifically, when you want to redirect the initial action / controller back then what is the best way to do this
Display the form for the user < Ul>
- In the form,
and % = Html.Hidden ("returnUrl")%>
to use - In action,
ViewData ["ReturnUrl"] = Request.Url;
. Otherwise, redirect to the homepage.- User submits form via post
returnUrl
model binding, if not < Code> null
This work has been done, but it seems that it will result in much more repetition. I also realized that I might have to Request.UrlReferrer
...
The way you are doing it is fine, but it seems that you have a bit of it Can overhauling. Does your post action take posts from more than one form? If not, why bother with the hidden field? You can get away from a simple Redirection Tiection ("Mayation")
Comments
Post a Comment