好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

ASP.NET MVC3 实现全站重定向的简单方法

MVC3用以下代码实现全站重定向

复制代码 代码如下:


protected void Application_BeginRequest(object sender, EventArgs e)
        {
            string strUrl = Request.Url.ToString().Trim().ToLower();
            if (strUrl.Contains("http://jb51.net"))
            {
                Response.RedirectPermanent(strUrl.Replace("http://jb51.net", "https://HdhCmsTestjb51.net"));
            }
        }

实现如:http://jb51.net/about 重定向到 https://HdhCmsTestjb51.net/about

查看更多关于ASP.NET MVC3 实现全站重定向的简单方法的详细内容...

  阅读:53次