登陆之后,可以返回到登陆前画面

1. Controllerthis

[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl)spa

2. Vieworm

@model MvcApplication2.Models.LogOnModel
string

@{it

    ViewBag.Title = "Log On";
io

    string retUrl = "";model

    if (ViewContext.HttpContext.Request.UrlReferrer != null)co

    {background

      retUrl =
        ViewContext.HttpContext.Request.UrlReferrer.PathAndQuery;
new

    } 

}

......

@using (Html.BeginForm("Logon", "Account",
  new { model = this.Model, returnUrl = retUrl }))

......

相关文章
相关标签/搜索