代码如下:
A页面
tbl_UserBLL userBLL = new tbl_UserBLL();
string sUserID = this.txt_UserName.Text.Trim();
string sUserPwd = this.txt_Pwd.Text.Trim();
string sJs = "";
tbl_UserInfo user = userBLL.GetUserByAccount(sUserID, sUserPwd);
if (user != null)
{ Session["RUNBOW.USER"] = user;
Response.Redirect("default.aspx");
}
else
{
sJs = "alert('" + Resources.lang.Login_ErrorInfor + "');";
}B页面
try
{
tbl_UserInfo tb = (tbl_UserInfo)Session["RUNBOW.USER"];
string id = tb.ID.ToString();
if (tb != null)
{
if (id == null)
{
Response.Redirect("SysLogin.aspx");
}
}
else
{
Response.Redirect("SysLogin.aspx");
}
}
catch
{
Response.Redirect("SysLogin.aspx");
}
-----------------------------------------------------------------------------
我在本地调试和发布B页面都能取到Session。
但是我把代码发布到公司服务器上B就取不到Session值了。
这是为什么啊?是不是哪里写的不对?请高人指教啊。
A页面
tbl_UserBLL userBLL = new tbl_UserBLL();
string sUserID = this.txt_UserName.Text.Trim();
string sUserPwd = this.txt_Pwd.Text.Trim();
string sJs = "";
tbl_UserInfo user = userBLL.GetUserByAccount(sUserID, sUserPwd);
if (user != null)
{ Session["RUNBOW.USER"] = user;
Response.Redirect("default.aspx");
}
else
{
sJs = "alert('" + Resources.lang.Login_ErrorInfor + "');";
}B页面
try
{
tbl_UserInfo tb = (tbl_UserInfo)Session["RUNBOW.USER"];
string id = tb.ID.ToString();
if (tb != null)
{
if (id == null)
{
Response.Redirect("SysLogin.aspx");
}
}
else
{
Response.Redirect("SysLogin.aspx");
}
}
catch
{
Response.Redirect("SysLogin.aspx");
}
-----------------------------------------------------------------------------
我在本地调试和发布B页面都能取到Session。
但是我把代码发布到公司服务器上B就取不到Session值了。
这是为什么啊?是不是哪里写的不对?请高人指教啊。
解决方案 »
- 在用户控件中拼装的带参数的url使用post方式提交
- 200 分请教几个问题。
- 如何将两个数据库合并到一起再进行操作
- 保存图片问题。
- Oralce数据库转成SQL数据库..请教!!!
- 急:在datalist中嵌入datagrid的问题
- 救命啊,有什么方法能够获得用户在某个窗口(可能是别人的窗口)的停留时间
- 我想问一下,下面的代码有什么不对的,浏览时为什么编译器说CreateDataSet未声明。(谢谢)
- 奇怪!DropDownList的问题!
- 高分呀!高分呀!高分呀!不够可以再加???一个关于ASP数据库的问题??????
- 盼正则表达式高手解答。
- datagrid中动态插入RadioButtonList后如何取得RadioButtonList选中项的值。
IIS里设置Session方法为:
在IIS里面右键点击默认网站->主目录->应用程序设置里点配置->选项->启用会话状态->会话超时那里设置时间