多用户登录Asp.net MVC4 Web应用程序 [英] Multi user sign in Asp.net MVC4 web application

查看:194
本文介绍了多用户登录Asp.net MVC4 Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个asp.net mvc4应用程序并在服务器中成功解密。



当我登录到已部署的Web应用程序时,它的工作正常,但当不同的用户使用自己的凭据从不同的设备登录时,我们的页面显然会被他们看到。他们无法访问他们的个人资料,而不是我的个人资料详细信息显示给他们。



一旦我退出后,他们可以查看他们的页面,反之亦然。



我倾向于解决问题。我粘贴了控制器并查看下面的代码。

I created an asp.net mvc4 application and depolyed it successfully in server.

When I login into the deployed web application its working fine, but when different user login from different device with their own credential,by surprise my page is visible to them. They cant access their profile instead of that my profile details are displaying to them.

Once after I logged out they can view their pages and its happening vice versa.

I am dumping my head to figure out the problem. I pasted the controller and view code below.

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);
}
}

View.Cshtml

 @if (Request.IsAuthenticated)
        {
            <div align="right" style="margin-removed10px;">  @Html.Encode(User.Identity.Name) 
            </div>
        }



Thanks in adavnce.

推荐答案

由于缺乏代码,我无法准确判断。最可能的原因是,将静态变量作为用户参数传递到登录方法
I can't judge exactly because of lack of code. Bur most possible reason, that you pass static variable as user parameter into your login method


这篇关于多用户登录Asp.net MVC4 Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆