如何在不同的命名空间中使用Session? [英] How to use Session in different Namespace?

查看:80
本文介绍了如何在不同的命名空间中使用Session?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



任何人都可以建议我是否可以在C#中的不同命名空间中使用会话,如果可以,请让步以放松身心并实现此目标..

请让我尽快知道...

Hi,

Can anyone advice me whether it is possible to use session in different Namespace in C#, If Yes, kindly let the steps to fallow and achieve this..

Kindly let me know ASAP...

If I have namespace A,B and when i store session value from an class in Namespace A,
From any class NameSpace B, I want to get the value of that session...

推荐答案

我不知道似乎正确理解了您的问题(您是在谈论ASP.Net中的会话吗?).
会话适用于整个网页的整体,并且与名称空间无关.
I don''t seem to understand your question correctly (are you talking about sessions in ASP.Net?).
A session is applicable for the entire web page as a whole and is not related to a namespace.


会话基于用户".单个用户可以在应用程序中访问它.

Session["myData"] = "someData";

现在,为同一用户在应用程序中的任何位置(也跨命名空间)访问Session ["myData"].
Session is ''user'' based. It is accessible across the application for a single user.

Session["myData"] = "someData";

Now, access Session["myData"] anywhere in your application(across namespaces too) for the same user.


这篇关于如何在不同的命名空间中使用Session?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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