使用会话变量 [英] Using Session variables

查看:91
本文介绍了使用会话变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个门户,该门户需要特定于特定用户的三个变量,因此我正在为此使用Session变量.这将导致每个用户总共创建4个会话变量,其中1个用于在登录期间验证用户身份,另外3个则根据需要.

我想知道以这种方式使用会话变量是否合适.

除了会话变量以外,还有其他方法可以管理这些变量以完成此任务.

I am developing a portal which requires three variables specific to particular user, so I am using Session variable for this purpose. This leads to creation of total 4 session variables per user, 1 for authenticating user during login and other 3 according to the requirement.

I want to know whether using session variables in such a manner is apt or not.

Is there any other way to manage these variables other than session variables in order to achieve this task.

推荐答案

您仅使用四个会话,这是正常的,这是最好的而不是使用QueryString或其他任何方法,只需确保您没有使用数据集,数据表等数据集即可.
You are using four sessions only its nominal and it is the best way instead of using QueryString or any thing else just make sure you are not using set of data like dataset, datatable etc. keep on


别担心.您走在正确的轨道上.每个会话4个变量不是开销.如果您仍然不想要它,则可以尝试在用户会话期间将变量存储在数据库中,并在用户注销时将其清除.
Don''t worry. You are on the right track. 4 variables per session is not a overhead. If you still don''t want it , then you can go the hard way and store the variables in database during the user session and clear them when the user logs out.


存储在它们中的数据,您还可以使用Cookie(例如,任何客户端状态管理技术)来查看,否则,Session听起来不错.

参考:
客户端状态管理对象 [有关ASP.NET状态管理的初学者教程 [ ^ ]
Based on the data stored in them, you can also look at using Cookies (as per say, any client side state management technique) Or else, Session sounds good.

Refer:
Client-Side State Management Objects [^]
A Beginner''s Tutorial on ASP.NET State Management[^]


这篇关于使用会话变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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