页面test.aspx中有一框架:
<frameset id="frame" framespacing="0" border="false" cols="180,*" frameborder="1" scrolling="yes">
<frame name="left" scrolling="auto" marginwidth="0" marginheight="0" src="Left.aspx">
<frameset framespacing="0" border="false" rows="15,*" frameborder="0" scrolling="yes">
<frame name="top" scrolling="no" src="">
<frame name="main" scrolling="auto" src="main.aspx">
</frameset>想实现如下功能:
如果某一session值为空,那么此test.aspx直接转向index.aspx页面.
在page_load()函数中使用下面的语句无反应:
if(Session["abc"].ToString()==null)
{
   Response.Redirect("index.aspx");
}请教实现方法!

解决方案 »

  1.   

    Response.Write("<script>window.parent.parent.location.href='index.aspx';</script>");
                Response.End();
      

  2.   

    if(Session["abc"]==null)
    {
       Response.Redirect("index.aspx");
    }
      

  3.   

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

  4.   

    if(Session["abc"].ToString()==null)
    {
       Response.Redirect("index.aspx");
    }
    这样写不对,如果Session["abc"]真的为空的话它就没法用ToTtring()
    建议这样
    Session["abc"] == null
      

  5.   

    已改成:
        protected void Page_Load(object sender, EventArgs e)
        {
                if (Session["Admin_Name"] == null)
                {
                    Response.Redirect("index.aspx");            }
        }
    依然没有反应!
      

  6.   

    已解决,按seaonce(雨花中的小皮鞋)的方法可以实现,在此表示感谢!