会话变量中的问题 [英] Problem in session variable
问题描述
大家好
我已经2页
1.登录页面。
2。用户页面。
在登录页面中我设置了一个会话变量
Session [Name] = abc;
i可以使用登录页面中的Response.Write访问会话变量。
之后我重定向到User.Aspx页面,但在这个页面(user.aspx)我无法访问会话变量。
请帮助我为什么无法访问会话变量在下一页。
请帮助
谢谢
转到page_Load事件
编写此代码以便第一次加载会话
代码
< pre lang =c#> if (!IsPostBack)
string strsession = ' ';
strsession =会话[ 名称];试试这个代码
谢谢和问候
Nagasiva
你好
只需在user.aspx的页面加载中写入
if (!IsPostBack)
{
String SessionName = String 跨度> .Empty;
SessionName =会话[ 名称]。ToString();
}
现在您可以访问SessionName变量会话值的值
谢谢
在user.aspx中的
page_load()事件写下面的代码
string sessionData = Session [name];
Hi all
I have made a 2 pages
1.Login Page.
2.User Page.
In the Login page i setted a session variable
Session["Name"] = "abc";
i can access the session variable using Response.Write in login page.
After that I redirecting to User.Aspx page ,but in this page(user.aspx) I can't access the session variable.
please help why i can't access the session variable in the next page.
Please Help
Thanks
go to page_Load event
write this code for acessing the session for 1st time load
code
if(!IsPostBack) string strsession=''; strsession=Session["Name"];try this code
Thanks&Regards
Nagasiva
Hello
Just Write like that in page load of user.aspx
if(!IsPostBack) { String SessionName = String.Empty; SessionName = Session["Name"].ToString(); }
Now You Can Access SessionName variable the value for Session Value
Thank You
in user.aspx page_load() event write the following code
string sessionData=Session["name"];
这篇关于会话变量中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!