将用户ID插入到不同用户的DB中存在问题。 [英] There is a issue with User IDs being inserted into DB for different Users.

查看:61
本文介绍了将用户ID插入到不同用户的DB中存在问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在开发Web应用程序,其中多个用户可以同时登录并对数据库执行某些操作;他们我们想用他们唯一的ID来验证他们。



那么我们如何在Session中保存他们的唯一ID,如UserID,我们这样做:

Hi,
I am developing Web Application in which more than one user can login at the same time and do something with database; their we want to use their unique ID to authenticate them.

So how we can hold their unique ID like UserID in Session, we have done like this:

Session["UserID"]=UserID.ToString();





但是有一个问题。

将数据插入带有唯一ID的数据库,它是在同一个应用程序的任何地方登录时互相替换ID。



请提供同样的解决方案。



非常感谢!



But there is a issue.
While inserting data into DB with their unique IDs, it is replacing their IDs with one another, while logging in from anywhere in the same application.

Please provide solution for the same.

Thanks in adavnce!

推荐答案

会话已经是每个用户,由IIS处理。每次用户连接时,它们都会获得一个唯一的会话,您无需为其编码。
Session already is per user, that is handled by IIS. Each time a user connects they get a unique session and you do not need to code for it.


在理想情况下,不应该发生此问题。



但无论如何我认为肯定还有其他一些问题;



1.可能是你的数据库端:像 UserID 列不是唯一键因此,您的表中正在创建重复的用户ID。由于这个登录问题发生。

2.或者您的应用程序代码中可能存在一些问题,例如您可能使用了 static 关键字。





因此,请彻底验证这两件事情。让我知道....
In ideal case this issue should not happen.

But anyhow I think there is certainly some other issue is there;

1. May be that''s at your DB side: Like UserID column is not unique key and hence duplicate user IDs are being created in your table. Due to which this login problem occurs.
2. OR may be there is some issue within your app code like you might have used static keyword.


So verify these two things thoroughly & let me know....


这篇关于将用户ID插入到不同用户的DB中存在问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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