会话未持续在第二页上 [英] Session Not persist on the second page

查看:94
本文介绍了会话未持续在第二页上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

我刚刚在我的项目中为登录用户启动了会话varibale.
我遇到的问题是,一旦我在会话变量中设置了登录ID.

Hi Friends,

I have just started the session varibale in my project for the logged in user.
The problem that i am getting is once i set the login id.in the session variable

Session["LoginID"]=userInfo.UserName;


它不在第二页上保留.它变为空白.
这背后的原因是什么.我也需要在另一页上进行该会话.

请帮帮我.
谢谢


it is not persist on the second page.it is coming blank.
what is the resion behind this.i need that session on the another page also.

Please help me.
Thanks

推荐答案

我确定该会话的某个位置已被清除.您需要遍历编码并找到要清除的地方.如果会话即将为空,则仅在代码中的某个位置将其设置为空,而您忘记了这一点.如果您的会话为空,请检查您为会话分配的值.试试这个:
I am damn sure that somewhere your session is getting cleared. You need to go through the coding and find the place where it is getting cleared. If your session is coming null then somewhere in code only you are making it null and you forgot about that. If your session is coming empty then check for the value you are assigning to the session. Try this:
if(userInfo.UserName != string.empty)
{
     Session["LoginID"]=userInfo.UserName;
}
else{
    //show error.
}




--Amit




--Amit


这篇关于会话未持续在第二页上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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