单点模式ASP.NET C#为每个用户 [英] Singleton-Pattern ASP.NET C# for each user

查看:83
本文介绍了单点模式ASP.NET C#为每个用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建设用asp.net C#的Web应用程序,我有,我想在每一次witouth实例它的多个页面中使用的类。我需要加载在它的数据,而不会在用户会话时间失去他们。我想过单身-模式,但它共享类beetween浏览器的实例。我该如何解决这个问题呢?

i'm building a web application with asp.net c# and i have a class that i want to use in multiple pages witouth instantiate it every time. I need to load the data in it and never lose them during the user session time. I thought about the singleton-pattern but it shared the instance of the class beetween browsers. How can i solve the problem?

推荐答案

辛格尔顿是不能解决问题的。看看会话状态,的的ViewState 和的饼干

Singleton is not the answer. Look at Session State, ViewState and Cookies.

这篇关于单点模式ASP.NET C#为每个用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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