Monday, August 21, 2017

MVC Sample to send current url while redirect to another page

public ActionResult MyNextAction()
{
    return Redirect(Request.Referrer);
}

public ActionResult MyFirstAction()
{
    return RedirectToAction("MyNextAction",
        new { r = Request.Url.ToString() });
}

then:

public ActionResult MyNextAction()
{
    return Redirect(Request.QueryString["r"]);
}

No comments:

Post a Comment