我如何在Ticket UserData属性中存储对象 [英] how could i store an object inside Ticket UserData property

查看:173
本文介绍了我如何在Ticket UserData属性中存储对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我如何将用户数据存储为票证UserData中的对象

我有一个SSUser类,该类对登录页面中当前用户的所有权限进行身份验证和加载
就是这个

Hello All

how could i store user data as object inside Ticket UserData

i have a class which is SSUser , this class authenticate and load all permissions of current user in the login page
as this

SSUser myUser=Authenticate("username","password");


用户名和密码正确时,Authenticate方法返回SSUser对象
现在我正在做的是将"myUser"保存在会话状态中,例如


Authenticate method return an object of SSUser when the username and password is correct
now what i am doing is saving this "myUser" in the Session state like this

Session.Add("User",myUser);


没问题,但是我已经读到,当应用程序同时被10个以上的用户使用时,在Session状态下存储对象会导致性能降低.
我的问题
我可以将这个"myUser"对象存储在Ticket.UserData中吗?
有什么解决方案吗?

非常感谢您


there is no problem with that , but i have read that storing object inside Session state lead to low performance when the application is used by more that 10 users at the same time.
my question
is could i store this "myUser" object inside the Ticket.UserData ??
is there any solution for that ?

thank you very much

推荐答案

我不知道什么是Ticket.UserData,但是如果它存储在服务器上,那么它将被使用会话(如果是每个用户对象).在会话中保存一些东西来管理登录数据是不可避免的.如果对象是轻量级的,则可能没问题.如果不是,请考虑存储一个id,并根据需要使用该ID填充数据库中的其他数据.
I have no idea what Ticket.UserData is, but if it''s stored on the server, then it''s going to use the session, if it''s a per user object. It''s unavoidable to save SOMETHING in the session to manage login data. If the object is lightweight, it''s probably OK. If it''s not, then consider storing an id and using that to populate your other data as needed from the DB.


这篇关于我如何在Ticket UserData属性中存储对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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