从类中访问会话 [英] accessing session from a class
问题描述
首先,我有 sessionState mode =" InProc" Cookie的= QUOT假QUOT;超时= QUOT; 180" 在web.config中
网页调用类"MyClass"中的方法('A')。这会创建一个这样的会话:
System.Web.HttpContext.Current.Session(" CHAIN")= 12345
在其他网页中 - response.write(SESSION(" CHAIN"))会显示12345.
现在,如果我调用方法('B')  ;在课堂上"MyClass"尝试阅读
System.Web.HttpContext.Current.Session(" CHAIN")
它出现为空值,不是12345
我缺少什么?
谢谢
GADOI
这不是VB语言问题。我想你会在
ASP.NET中获得该主题专家的最佳帮助论坛跨度> 。
First I have sessionState mode="InProc" cookieless="false" timeout="180" in web.config
A web page calls a method('A') in a class "MyClass" that creates a session like this:
System.Web.HttpContext.Current.Session("CHAIN")=12345
In other web pages - response.write(SESSION("CHAIN")) displays 12345 as it should.
Now, if I call method('B') in class "MyClass" that attempts to read
System.Web.HttpContext.Current.Session("CHAIN")
it comes up as a null value, not 12345
What am I missing?
Thank you
GADOI
This is not a VB language question. I think you will get the best help from experts in that topic in the ASP.NET Forums.
这篇关于从类中访问会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!