页面静态化与伪静态 URL重定向

        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            string ss = HttpContext.Current.Request.Url.AbsolutePath;

            string url1 = "/index.html";          
            if (HttpContext.Current.Request.Url.AbsolutePath == url1)
            {
                HttpContext.Current.RewritePath("login.aspx");
            }
            //2
            string url2 = "/qxsz/index.html";
            if (HttpContext.Current.Request.Url.AbsolutePath == url2)
            {
                HttpContext.Current.RewritePath("index.aspx");
            }

        }

上面的代码是在global.ashx中

你可能感兴趣的:(Asp.net,C#知识点)