框架中的某个aspx页面,如何让整个框架转到另一个页面?
框架页面:
<script Language= "C# " runat= "server ">
public void Page_Load(object sender,EventArgs e){
if (Session[ "ValidUser "]!= "YES ")
Response.Redirect( "Login.aspx ");
}
</script>
<html>
<head>
<meta name= "GENERATOR " Content= "Microsoft Visual Studio .NET 7.1 ">
</head>
<frameset cols= "200,* " >
<frame id= "fraLeft " src= "Left.aspx " name= "fraLeft " scrolling= "no " />
<frame id= "fraRight " src= "AdminTimePrice.aspx " name= "fraRight " />
</frameset>
</html>
现在是,如果其中一个页面Left.aspx检测到Session[ "ValidUser "]!= "YES "时,如何让整个框架转到login.aspx页面,而不只是左边的Frameset?
------解决方案--------------------up
------解决方案--------------------在事件里加这个判断
if (Session[ "ValidUser "]!= "YES ")
{
Response.Write( " <script> parent.location.href= 'Login.aspx '; </script> ");
}
------解决方案--------------------这种情况你就用javascript,跳转的框架用top就可以了~
------解决方案--------------------用js跳转呀
------解决方案--------------------行 5: public void Page_Load(Object sender, EventArgs e){
行 6: if (Session[ "ValidUser "]!= "YES ")
行 7: Response.Write( " <script language=JavaScript> window.location.href=\ "login.apx\ "; </script> ");
直接写转义的吧
------解决方案--------------------if (Session[ "ValidUser "]!= "YES ")
{
Response.Write( " <script> window.top.location.href=\ "Login.aspx\ "; </script> ");
}