我的父页面代码<%@ 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是否过期,父页面就跳转了。
各位大虾,请问这是为什么啊???

解决方案 »

  1.   

    你用的时候session已经存在了?
      

  2.   

    懒得看内从,只看标题,感觉很多人把session丢失叫做session“过期”,这就纯粹会导致自欺欺人的的议论。
      

  3.   

    存在,我登陆后,从login.aspx跳转到index.aspx(父页面),一段时间不操作的话就跳转到登陆页面
      

  4.   

    那我不判断直接跳转,和判断了跳转有什么区别呢?都是无错误的按流程执行了,if (Session["uid"]==null)
            {
                Response.Write("<script>window.parent.location.href='login.aspx';</script>");
            }确实是进入了if方法里面执行,
    可为什么一个会跳一个不会跳呢??
      

  5.   

    Session都没有了 哪里还来Session["uid"]
    if(Session.Count>0)
    {
        if (Session["uid"]==null)
            {
            }
    }
      

  6.   

    Session都没有了 哪里还来Session["uid"]
    if(Session.Count>0)
    {
        if (Session["uid"]==null)
            {
            }
    }
      

  7.   

    Session丢失之后跳转到登陆页面?把问题语言组织下 大家才能更快更好更准确的帮助你解答
      

  8.   

    1.ASP.NET基础
    2.逻辑问题...
      

  9.   

    session 是你设定的时间以后会过期。 
    如果你根本就没session  那么就没有过期的可能性存在。
    至于session丢失。这个很正常。 
      

  10.   

    if (Session["uid"]==null&& Session["uid"]=="")
             {
                 Response.Write("<script>window.parent.location.href='login.aspx';</script>");
             }
      

  11.   


    每天回帖即可获得10分可用分!小技巧:教您如何更快获得可用分 你还可以输入10000个字符(Ctrl+Enter)
      

  12.   

    我估计他想说的不是Session丢不丢失问题
    而是为啥没有跳转
    Test
    先弄个服务器控件Button  OncliCk看看能不能跳转
    再Response.Write(Session["uid"]); 看看到底有没有