Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- return RedirectToAction("Action1", "YourControllerName");
- public ActionResult Action2(string backUrl)
- {
- if (string.IsNullOrEmpty(backUrl))
- {
- throw new ArgumentNullException("backUrl");
- }
- ViewBag.ReturnUrl = backUrl;
- //your work
- return View();
- }
- [HttpPost]
- public ActionResult Action2(YourModel model, string backUrl)
- {
- //your work
- return Redirect(backUrl);
- }
- ...
- @Html.ActionLink("text", "Action2", new { backUrl = Url.Action("Action1") })
- ...
- ...
- <input name='backUrl' type='hidden' value='@ViewBag.ReturnUrl' />
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement