会话在内容页面中返回null [英] Session returns null in Content Page

查看:84
本文介绍了会话在内容页面中返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在我的网络应用程序中使用母版页,我的问题是,所有内容页面中的会话都为空。当然会话是由使用母版页的登录页面创建的。



每个内容页面和web.config正确设置为enableSessionState = true

但是母版页中没有会话启用属性,



和内容页面中IsNewSession属性返回true ???

是否创建内容页面中的新会话?





任何帮助!!提前谢谢。

Hi,

I''m using master page in my web application, my problem is, session is null in all content pages. of course session is created by Login page that is using master page.

each Content Page and web.config set properly for enableSessionState =true
but there is no Session enable property in Master Page,

and in Content page IsNewSession Property returns true ???
is it create new session in Content Page ?


any help !! thanks in advance.

推荐答案

大家好,





我有最终解决方案,HttpContext.Current.Session返回null的唯一原因是因为我在web.config中设置了CookieLess = true,如果我想从Web项目外部访问HttpContext.Current.Session,则默认为false。 />




谢谢
Hi All,


I Got the Final Solution, The only reason why HttpContext.Current.Session returning null is because i am set CookieLess =true in web.config , which is default false if i want to access HttpContext.Current.Session from outside the web project.


Thanks


检查这个...

session [ username] = txtusername.text;

否则

session.add(username)= txtusername.text;
check this...
session["username"]=txtusername.text;
otherwisewise
session.add("username")=txtusername.text;


这篇关于会话在内容页面中返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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