0

下面代码中的所有内容都很好用。日志记录。但是重定向永远不会发生....

        if (HttpContext.Current.Request.Url.Host.ToLower().Trim() == "mydomain.com")
        {
            if (!HttpContext.Current.Request.IsSecureConnection)
            {
                LogThis.WriteLog("redirecting");
                HttpContext.Current.Response.Redirect(
                    string.Concat("https://mydomain.com", Request.RawUrl));
                HttpContext.Current.Response.End();
            }
        }

有任何想法吗?这一切都发生在 Global.asax 中的 Application_BeginRequest 中。它是内联代码,在标签内。根本没有代码隐藏。

4

0 回答 0