Forum Moderators: open

Message Too Old, No Replies

Displaying specifc data depending on SSL or non-SSL in ASP pages

         

midoriweb

10:54 am on Jan 10, 2007 (gmt 0)

10+ Year Member



I need to display one piece of information for non-SSL (http://) users and another for SSL users (https://).

I found this code and it seems to be working just like I need it to:

<% If Request.ServerVariables("SERVER_PORT")=80 Then %>
I display my non-SSL code here
<% Else %>
I display my SSL code here
<% End If %>

Is this the best/right way to go about this? Is there a better way then calling which port the server is running on? Although my above code is working I just want to make sure I'm using it correctly and it's the best way to accomplish what I need.

txbakers

4:53 am on Jan 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I do it this way:

if (String(Request.ServerVariables("HTTPS")) == "off")
not SSL
else
SSL
end if

But I think your way is fine. The only thing I'd be concerned about is that ports can change. HTTP is 99.44% on port 80, but you really can route it elsewhere.

midoriweb

7:47 am on Jan 12, 2007 (gmt 0)

10+ Year Member



I think your way is better :)... but... when I tried the following it wouldn't work:

<% If (String(Request.ServerVariables("HTTPS") == "off")) Then %>
NON-SSL Stuff
<% Else %>
SSL Stuff
<% End If %>

aspdaddy

3:30 pm on Jan 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check what scripting language are you using, some languages use == for equality and = for assignment.