Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell if a page is SSL in ASP?

How do I tell if a page is SSL'd in "classic" ASP? I can't use Javascript because what I'm outputting is the results of a <noscript> tag.

This can't be changed or modified in IIS. It has to be in the script file itself.

  • https://example.com/something.asp should say YES
  • http://example.com/something.asp should say NO
like image 467
Matt Rogish Avatar asked Apr 10 '09 14:04

Matt Rogish


2 Answers

You should be able to get this info via

Request.ServerVariables("HTTPS")

See here for more info.

like image 86
Kevin Tighe Avatar answered Nov 11 '22 06:11

Kevin Tighe


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

<%
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" />
like image 22
webmaster_sean Avatar answered Nov 11 '22 06:11

webmaster_sean