public ActionResult AdminPanel()
{
if (UserContext.currentProfileRole.ToString() == Roles.User.ToString())
{
Response.Write("<script>alert('You have no permission to access this page!');window.location.href='/HomePage';</script>");
Response.End();
}
return View();
}
问题: 即使是加了End() , return View();还是会执行
原因: 1.在winform 或者 page_load 当执行END的时候就会结束本页面,不会再执行下一步.所以这个问题. 只存在MVC
解决方案: 加上一句 Return null;
参考链接:https://q.cnblogs.com/q/51647/