ASP.NET MVC 3は、全局リダイレクトを実現する簡単な方法です。


MVC 3は、全局リダイレクト

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://www.jb51.net"));
            }
        }
を以下のコードで実現する。
実現例:http://jb51.net/about リダイレクトhttps://www.jb51.net/about