c# - .asax.cs 页面附加 :443 to URLs

标签 c# ssl https

我不熟悉 ASP 或 C#,但我遇到了一个难题,在强制 SSL/Mobile View URLS 后附加了 :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);
            }

你们都是👼👼👼👼👼

最佳答案

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

  builder1.Port = -1;

在附加/Mobile 之前

关于c# - .asax.cs 页面附加 :443 to URLs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49495026/

相关文章:

c# - 组合 URI 和路径

c# - TPL DataFlow 无法处理 ActionBlock 中的异常

html - Confluence html宏ssl异常

android - 自签名证书 "doesn' 包含 CN 或 DNS subjectAlt”

c# - 取消任务

c# - 更改 LiveCharts 中轴刻度标签的格式

ssl - new_ssl 在哪里?

c# - 根据自签名证书的验证程序,远程证书无效

apache - %25 附加在 htaccess 重定向的 Url 中

java - 在 Tomcat 服务器中使用自签名证书的可信 SSL,无需在浏览器中导入证书