【发布时间】:2018-03-12 05:50:04
【问题描述】:
//I Have a Action Method
[HttpGet]
public ActionResult Login()
{
return View();
}
[HttpPost]
public ActionResult Login(VmUser_User VmUser_User)
{
if (VmUser_User.User_User.UserName == null ||
VmUser_User.User_User.Password == null)
{
VmUser_User.LblError = "Please enter Username and Password";
return View(VmUser_User);
}
//Return valid user
if (VmUser_User.LoginUser() > 0)
{
Session["One"] = VmUser_User;
return RedirectToAction("Index", "Home");
}
else
{
VmUser_User.LblError = "User/Password does not match!";
}
return View(VmUser_User);
}
//And another Action Method
public async Task<ActionResult> Common_Unit()
{
Oss.Romo.ViewModels.User.VmUser_User user =
(Oss.Romo.ViewModels.User.VmUser_User)Session["One"];
if (user == null)
{
return RedirectToAction("Login", "Home");
}
vmCommon_Unit = new VmCommon_Unit();
await Task.Run(() => vmCommon_Unit.InitialDataLoad());
return View(vmCommon_Unit);
}
当一个有效的用户登录应用程序时,它会重定向到 Home/Index 页面,然后他请求 Common/Common_Unit 页面。会话到期后,用户重新登录我想在最后请求的页面(如 Common/Common_Unit)中重定向的应用程序,请有人帮我解决这个问题。
我的问题:当授权用户浏览特定页面时,他会在一段时间内处于非活动状态。在最短时间会话结束,用户进入登录页面。登录后,我想在此特定页面上重定向用户。对不起我的英语不好
【问题讨论】:
标签: c# asp.net-mvc