我创建了一个asp.net mvc4应用程序并在服务器中成功解密。
当我登录到已部署的Web应用程序时,它的工作正常,但当不同的用户使用自己的凭据从不同的设备登录时,我们的页面显然会被他们看到。他们无法访问他们的个人资料,而不是我的个人资料详细信息显示给他们。
我退出后,他们可以查看他们的页面,反之亦然。
我倾向于解决问题。
Controller.cs
[HttpPost]
public ActionResult LogIn(ECusertables user,int id=0)
{
if (IsValid(user.Email, user.Password))
{
user = db.ECusertables.Where(u => u.Email == user.Email).Select(i => i).FirstOrDefault();
FormsAuthentication.SetAuthCookie(user.Email, false);
}
} @if (Request.IsAuthenticated) //View.Cshtml
{
<div align="right" style="margin-removed10px;"> @Html.Encode(User.Identity.Name)
</div>
}
谢谢你。