我要实现没有登陆的用户发生跳转?代码如下:
public void PageBegin()
{ if(Session["LoginID"]==null|| Session["UserName"]==null||Session["UserType"]==null)
{
JScript.JumpToNewWindow("login.aspx");
}
}
public static void JumpToNewWindow(string Url)
{
string js=@"<Script language='JavaScript'>
                    window.opener.location='"+Url+"';</Script>";
HttpContext.Current.Response.Write(js); 
}
怎么会没有发生跳转啊???

解决方案 »

  1.   

    用Response.Redirect("./index.aspx");岂不挺好
      

  2.   

    window.parent.location.href=....
      

  3.   

    string js=@"<Script language='JavaScript'>
                        window.top.location='"+Url+"';</Script>";
      

  4.   

    Page.RegisterStartupScript("confirm", tmp)
    RegisterStartupScript()方法将<script>
     块置于 Web 窗体的结尾处,以保证在执行客户端脚本之前已声明 Web 窗体中的所有 HTML 元素。RegisterClientScriptBlock() 方法用于为响应客户端事件而执行的脚本代码。通过此方法发送的脚本块位于 Web 页面的开始处,因为这种方法不要求将脚本块置于所有 HTML 元素之后。
      

  5.   

    是有框架的,用用Response.Redirect("./index.aspx");只发生框架的跳转,没有全部跳转啊