我的父页面代码<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<frameset>
<FRAMESET frameSpacing=0 rows=80,* frameBorder=0>
<FRAME name=top src="Top.aspx" frameBorder=0 noResize scrolling=no>
<FRAMESET frameSpacing=0 frameBorder=0 cols=220,*>
<FRAME name=menu src="Menu.aspx" frameBorder=0 noResize>
<FRAME name=Main src="dpset.aspx" frameBorder=0>
</FRAMESET>
<NOFRAMES>
<p>
This page requires frames, but your browser does not support them.</p>
</NOFRAMES>
</FRAMESET>
</frameset>
</html>我在dpset.aspx页面中判断session是否过期:protected void Page_Load(object sender, EventArgs e)
{
if (Session["uid"]==null)
{
Response.Write("<script>window.parent.location.href='login.aspx';</script>");
}
}通过断点跟踪能执行到Response.Write("<script>window.parent.location.href='login.aspx';</script>");可就是不跳转???
可我要是这样写protected void Page_Load(object sender, EventArgs e)
{
Response.Write("<script>window.parent.location.href='login.aspx';</script>");
}不判断session是否过期,父页面就跳转了。
各位大虾,请问这是为什么啊???
<head runat="server">
<title></title>
</head>
<frameset>
<FRAMESET frameSpacing=0 rows=80,* frameBorder=0>
<FRAME name=top src="Top.aspx" frameBorder=0 noResize scrolling=no>
<FRAMESET frameSpacing=0 frameBorder=0 cols=220,*>
<FRAME name=menu src="Menu.aspx" frameBorder=0 noResize>
<FRAME name=Main src="dpset.aspx" frameBorder=0>
</FRAMESET>
<NOFRAMES>
<p>
This page requires frames, but your browser does not support them.</p>
</NOFRAMES>
</FRAMESET>
</frameset>
</html>我在dpset.aspx页面中判断session是否过期:protected void Page_Load(object sender, EventArgs e)
{
if (Session["uid"]==null)
{
Response.Write("<script>window.parent.location.href='login.aspx';</script>");
}
}通过断点跟踪能执行到Response.Write("<script>window.parent.location.href='login.aspx';</script>");可就是不跳转???
可我要是这样写protected void Page_Load(object sender, EventArgs e)
{
Response.Write("<script>window.parent.location.href='login.aspx';</script>");
}不判断session是否过期,父页面就跳转了。
各位大虾,请问这是为什么啊???
{
Response.Write("<script>window.parent.location.href='login.aspx';</script>");
}确实是进入了if方法里面执行,
可为什么一个会跳一个不会跳呢??
if(Session.Count>0)
{
if (Session["uid"]==null)
{
}
}
if(Session.Count>0)
{
if (Session["uid"]==null)
{
}
}
2.逻辑问题...
如果你根本就没session 那么就没有过期的可能性存在。
至于session丢失。这个很正常。
{
Response.Write("<script>window.parent.location.href='login.aspx';</script>");
}
每天回帖即可获得10分可用分!小技巧:教您如何更快获得可用分 你还可以输入10000个字符(Ctrl+Enter)
而是为啥没有跳转
Test
先弄个服务器控件Button OncliCk看看能不能跳转
再Response.Write(Session["uid"]); 看看到底有没有