如何判断ASP中的页面是否为SSL?

时间:2022-01-24 04:15:00

How do I tell if a page is SSL'd in "classic" ASP? Can't use javascript because what I'm outputting is the results of a "noscript" tag. :D

如何在“经典”ASP中判断页面是否为SSL?不能使用javascript,因为我输出的是“noscript”标签的结果。 :d

Can't be changed or modified in IIS - has to be in the script file itself.

无法在IIS中更改或修改 - 必须在脚本文件本身。

e.g. https://foobar/something.asp --> should say YES http://foobar/something.asp --> should say NO

例如https://foobar/something.asp - >应该说YES http://foobar/something.asp - >应该说NO

2 个解决方案

#1


You should be able to get this info via

您应该可以通过此信息获取此信息

Request.ServerVariables("HTTPS")

See here for more info.

有关详细信息,请参见此处

#2


I used this to change image links to https to avoid weird IE messages:

我使用它将图像链接更改为https以避免奇怪的IE消息:

<%
dim socket
If Request.ServerVariables("HTTPS") = "on" then 
socket = "https"
else
socket = "http"
End if
%>

Then

 <img src="<%response.write(socket)%>://website.com/images/logo.png" class="logo" alt="logo" />

#1


You should be able to get this info via

您应该可以通过此信息获取此信息

Request.ServerVariables("HTTPS")

See here for more info.

有关详细信息,请参见此处

#2


I used this to change image links to https to avoid weird IE messages:

我使用它将图像链接更改为https以避免奇怪的IE消息:

<%
dim socket
If Request.ServerVariables("HTTPS") = "on" then 
socket = "https"
else
socket = "http"
End if
%>

Then

 <img src="<%response.write(socket)%>://website.com/images/logo.png" class="logo" alt="logo" />