.asax.cs页面追加:443到URL

时间:2018-03-26 15:20:36

标签: c# ssl https

我不熟悉ASP或C#,但我处于一个难题,强制SSL /移动视图后,URL附加了:443。例如,用户将被投放https://www.example.com/Mobile:443/ 代替 : https://www.example.com/Mobile

我认为这是global.asax.cs页面中相关的代码区域:

            if (!isOnMobilePage && !isOnMobilePageJSLib && !isOnMobilePageImages && !isOnMobilePageContent && !isOnMobilePageScripts && !isOnMobilePageJS && !isOnMobilePagescrollbar && !isOnMobilePagefonts)
            {
                string URL1 = Context.Request.Url.AbsoluteUri.ToString();
                Uri uri1 = new Uri(URL1);
                UriBuilder builder1 = new UriBuilder(uri1);
                builder1.Host = builder1.Host + "/Mobile";

                Uri result1 = builder1.Uri;
                URL1 = result1.AbsoluteUri.ToString();
                string redirectTo1 = URL1.Replace(":80", "");

               HttpContext.Current.Response.Redirect(redirectTo1);
            }

你们都是

1 个答案:

答案 0 :(得分:0)

443是SSL端口。要删除它,请尝试

  builder1.Port = -1;
在追加/ Mobile

之前