【发布时间】:2013-10-22 10:23:40
【问题描述】:
我有一个站点和该站点的测试版本托管在同一台服务器上。我希望实时版本使用 ssl 但不是测试版本。我使用以下代码强制实施 SSL 进行实时而不是测试:
If HttpContext.Current.Request.IsSecureConnection.Equals(False) AndAlso HttpContext.Current.Request.IsLocal.Equals(False) AndAlso HttpContext.Current.Request.RawUrl.Contains("test.mydomain.com") = False Then
Response.Redirect("https://" + Request.ServerVariables("HTTP_HOST") + HttpContext.Current.Request.RawUrl)
End If
该网站的实时版本是 live.mydomain.com。
我得到的结果是任何对 test.mydomain.com 的请求都会转到 live.mydomain.com。我不知道这怎么可能。浏览器实际上在地址字段中显示 test.mydomain.com,但显然使用的是实时版本。 test.mydomain.com 没有 SSL 绑定。我在这上面花了几天时间,想知道是否有人知道我的代码出了什么问题,或者我还可以尝试什么。
提前多谢
【问题讨论】: