自定义了一个HttpModule类,实现Init方法,方法中的事件
现在问题是我运行程序,程序一直就是死循环在登录
打断点看了下,if(n==-1) 如果成立就是没有从Admin_Login.aspx窗体登录,它会一直执行if里的内容,而且会重复执行,不会退出,请大家看下哪里出问题了?        public void Init(System.Web.HttpApplication context) {
           context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);
        }        void context_PreRequestHandlerExecute(object sender, EventArgs e)
        {
            HttpApplication ha = (HttpApplication)sender;
            string path = ha.Context.Request.Url.ToString();
            int n = path.ToLower().IndexOf("Admin_Login.aspx");
            if (n == -1) //是否是登录页面,不是登录页面的话则进入{}
            {
                if (ha.Context.Session["CurrentAdmin"] == null) //是否Session中有用户名,若是空的话,转向登录
                {
                    ha.Context.Response.Redirect("Admin_Error.aspx");
                }
            }           
        }