C# 类库中跳转页面

     /// <summary>
        /// 验证用户是否已经登录
        /// </summary>
        public void IsLogin()
        {
            if (!SessionIsExistence("userid")) //判断Session是否存在
            {
                System.Web.HttpContext.Current.Response.Write("<script>parent.location.href='" + System.Web.HttpContext.Current.Request.ApplicationPath + "/login/Default.html';</script>");
            }
        }

其中,如果跳转的js使用window.location.href的话,在页面使用模板的情况下整个页面是不会跳转的,所以要用parent来跳转到登录页面

posted on 2012-08-21 14:17  LitDev  阅读(594)  评论(0编辑  收藏  举报