保留应用程序mvc中的数据 [英] Retain data in application mvc

查看:83
本文介绍了保留应用程序mvc中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想问一下,当我登录时,我想保留用户信息以便在所有应用程序中使用。现在,我正在使用Session。好吗 ?有没有更好的解决方案?

Hi all,
I want to ask when i log in , i want to retain user infomation to use in all application . Now, i am using Session. Is it good ? Is there any better solution ?

推荐答案

是的,您可以使用Session来存储值,但是您使用Session的方式在哪个模式中最重要。 Donot使用会话来存储更多值。如果您使用的是存储库模式,则有更好的方法来使用会话。

如果要存储值并在整个应用程序中使用,您应该尝试使用SqlServer状态进行会话。

Yes you can use Session to store the values, but the way you use Session In which mode is what matters. Donot use session to store more values..if you are using repository pattern, there is a better way to use session.
You should try and use SqlServer state for session in case you want to store values and use throughout the application.
SQLServer mode stores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.



来自Msdn的定义。

希望这会有所帮助..

如果有任何问题,请回复您的评论..


Definition from Msdn.
Hope this helps..
Post back your comments with queries if any..


这篇关于保留应用程序mvc中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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