如何在asp.net中使用sessionstate限制多用户冲突? [英] how to use sessionstate in asp.net to restrict multiuser conflicts?

查看:90
本文介绍了如何在asp.net中使用sessionstate限制多用户冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我刚刚加入这个社区,并获得了很大的帮助.感谢大家.有人可以用示例说明我吗,当两个或多个用户同时登录时,如何维护他们的会话.这样可以避免任何冲突.
请以完整的多用户示例向我解释.我正在asp.net上使用c#.感谢....

Hi am yogesh, i just joined this community and getting great help. thanks to all of you. can someone explain me with example that when two or more users are logged in at the same time, how to maintain their sessions. So that to avoid any conflicts.
please explain me with complete example of multiusers. i am using c# with asp.net THANKS IN ADVANCE....

推荐答案

Page类具有名为Session的属性,该属性是HttpSessionState类.

您可以使用该对象存储特定于当前登录用户的信息.在较高的级别上,每个登录的用户都有一个该对象的单独实例,因此您可以使用以下内容:

将信息存储到会话中"
The Page class has a property called Session that is an instance of the HttpSessionState class.

You can use this object to store information specific to the currently logged in user. On a high level, each logged in user has a separate instance of this object, so you can use something like this:

To store information to session"
Session["UserName"] = txtUserName.Text;



要读取会话信息:



To read session information:

string userName = Session["UserName"].ToString();



[



This[^] article will get you started on using sessions.


这篇关于如何在asp.net中使用sessionstate限制多用户冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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