if (window.parent != null)
{
   // 不等 null 说有你的网页有个父窗口,在这个时候就把网页转到别的页面去
   window.location = url;
}

解决方案 »

  1.   

    <SCRIPT LANGUAGE=javascript><!-- 
    if (top.location != self.location)top.location=self.location;
    // --></SCRIPT>
      

  2.   

    放在你的页面中.<script>
    if(top!=self){top.location=location}
    </script>
      

  3.   

    最好还是在服务器端使用isapi,就是麻烦了一些,要么就是if(top!=self){top.location=location},但是我同样可以把它k掉,如果我想
      

  4.   

    using System;
    using System.Web; 
    using System.Web.SessionState;
    namespace NetEa.MyModule
    {
    /*
     使用方法:
     在Web.config中加入
     <system.web>
     <httpModules>
    <add name=" MyModule " type=" MyModule, MyModule" /> 
    </httpModules>
     </system.web>
     代码
    */
    public class MyModule : IHttpModule,IRequiresSessionState
    {
    public void Init(HttpApplication application) 

    application.AcquireRequestState += (new 
    EventHandler(this.Application_AcquireRequestState));
    }
    private void Application_AcquireRequestState (Object source,EventArgs e) {
    HttpApplication Application = (HttpApplication)source;
    try
    {
    if (Application.Context.Request.Path.ToString().IndexOf("StudentPhoto",0)!=-1 && Application.Session["userid"]==null )
    {
    Application.Context.Response.Write ("没有访问权限!");
    Application.Context.Response.End();
    }
    }
    catch(Exception ex)
    {
    Application.Context.Response.Write ("没有访问权限!");
    Application.Context.Response.End();
    }

    }
    public void Dispose() 
    {

    }
    }
    }这个是限制任意访问图片库的程序,只要把限制具体一些就可以了,这个要。net