473,287 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

HTTP to HTTPS redirect

I am using the following code in my default.asp page to redirect the page
from HTTP to HTTPS

<%

if Request.ServerVariables("HTTPS") = "off" Then

Response.Redirect("https://" & Request.ServerVariables("HTTP_HOST") &
Request.ServerVariables("URL"))

End if
%>

I got the code off of a website and found that many web sites had similar
code for doing the same thing. The problem I am having is that the code
will not redirect to the HTTPS and will keep reloading the page. Is there a
setup issue with IIS that I might be missing?

Thanks

Bob Hansen
Jul 19 '05 #1
5 89517
Bob Hansen wrote:
I am using the following code in my default.asp page to redirect the
page from HTTP to HTTPS

<%

if Request.ServerVariables("HTTPS") = "off" Then

Response.Redirect("https://" &
Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL"))

End if
%>

I got the code off of a website and found that many web sites had
similar code for doing the same thing. The problem I am having is
that the code will not redirect to the HTTPS and will keep reloading
the page. Is there a setup issue with IIS that I might be missing?

Thanks

Bob Hansen


Have you verified that Request.ServerVariables("HTTPS") contains what you
think it contains? Response.Write it to be sure.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #2

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:eO**************@TK2MSFTNGP09.phx.gbl...
Bob Hansen wrote:
I am using the following code in my default.asp page to redirect the
page from HTTP to HTTPS

<%

if Request.ServerVariables("HTTPS") = "off" Then

Response.Redirect("https://" &
Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL"))

End if
%>

I got the code off of a website and found that many web sites had
similar code for doing the same thing. The problem I am having is
that the code will not redirect to the HTTPS and will keep reloading
the page. Is there a setup issue with IIS that I might be missing?

Thanks

Bob Hansen


Have you verified that Request.ServerVariables("HTTPS") contains what you
think it contains? Response.Write it to be sure.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Value is set to "off" on the first pass, after that I cannot tell because it
keeps redirecting into a loop so I am pretty sure that the server variable
for HTTPS is never getting set to anything but "off"
Jul 19 '05 #3
Have you try this method ?

http://www.iisfaq.com/default.aspx?View=A407&P=20

--
---------------------------------------------------------------------
"Are you still wasting your time with spam?...
There is a solution!"

Protected by GIANT Company's Spam Inspector
The most powerful anti-spam software available.
http://mail.spaminspector.com
"Bob Hansen" <bh*********************@jascorp.com> a écrit dans le message
de news:Ol*************@TK2MSFTNGP11.phx.gbl...

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:eO**************@TK2MSFTNGP09.phx.gbl...
Bob Hansen wrote:
I am using the following code in my default.asp page to redirect the
page from HTTP to HTTPS

<%

if Request.ServerVariables("HTTPS") = "off" Then

Response.Redirect("https://" &
Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL"))

End if
%>

I got the code off of a website and found that many web sites had
similar code for doing the same thing. The problem I am having is
that the code will not redirect to the HTTPS and will keep reloading
the page. Is there a setup issue with IIS that I might be missing?

Thanks

Bob Hansen
Have you verified that Request.ServerVariables("HTTPS") contains what you think it contains? Response.Write it to be sure.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Value is set to "off" on the first pass, after that I cannot tell because

it keeps redirecting into a loop so I am pretty sure that the server variable
for HTTPS is never getting set to anything but "off"

Jul 19 '05 #4
That didnt work either. This solution just made it so all of the pages were
unauthorized for viewing.
"Laurent VAN ACKER" <lv*******@nospam.free.fr> wrote in message
news:1070629643.830469@atn04...
Have you try this method ?

http://www.iisfaq.com/default.aspx?View=A407&P=20

--
---------------------------------------------------------------------
"Are you still wasting your time with spam?...
There is a solution!"

Protected by GIANT Company's Spam Inspector
The most powerful anti-spam software available.
http://mail.spaminspector.com
"Bob Hansen" <bh*********************@jascorp.com> a écrit dans le message
de news:Ol*************@TK2MSFTNGP11.phx.gbl...

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:eO**************@TK2MSFTNGP09.phx.gbl...
Bob Hansen wrote:
> I am using the following code in my default.asp page to redirect the
> page from HTTP to HTTPS
>
> <%
>
> if Request.ServerVariables("HTTPS") = "off" Then
>
> Response.Redirect("https://" &
> Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")) >
> End if
> %>
>
> I got the code off of a website and found that many web sites had
> similar code for doing the same thing. The problem I am having is
> that the code will not redirect to the HTTPS and will keep reloading
> the page. Is there a setup issue with IIS that I might be missing?
>
> Thanks
>
> Bob Hansen

Have you verified that Request.ServerVariables("HTTPS") contains what you think it contains? Response.Write it to be sure.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Value is set to "off" on the first pass, after that I cannot tell because it
keeps redirecting into a loop so I am pretty sure that the server

variable for HTTPS is never getting set to anything but "off"


Jul 19 '05 #5
Put a page containing the following in the same directory as your other
page.

Response.Write Request.ServerVariables("HTTPS")

call it using http: and see what it returns.
then call it using https

This might give you a clue.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Bob Hansen" <bh*********************@jascorp.com> wrote in message
news:Ol*************@TK2MSFTNGP11.phx.gbl...

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:eO**************@TK2MSFTNGP09.phx.gbl...
Bob Hansen wrote:
I am using the following code in my default.asp page to redirect the
page from HTTP to HTTPS

<%

if Request.ServerVariables("HTTPS") = "off" Then

Response.Redirect("https://" &
Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL"))

End if
%>

I got the code off of a website and found that many web sites had
similar code for doing the same thing. The problem I am having is
that the code will not redirect to the HTTPS and will keep reloading
the page. Is there a setup issue with IIS that I might be missing?

Thanks

Bob Hansen
Have you verified that Request.ServerVariables("HTTPS") contains what you think it contains? Response.Write it to be sure.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Value is set to "off" on the first pass, after that I cannot tell because

it keeps redirecting into a loop so I am pretty sure that the server variable
for HTTPS is never getting set to anything but "off"

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Grunff | last post by:
I'm experiencing an interesting problem with carrying a php session over from http to https. Much googling later, I'm still stuck. The application is an online shop, where some user data is...
4
by: Chris Ashley | last post by:
Is it possible to persist viewstate information between HTTP and HTTPS (on the same page obviously)? Trying to get around writing some messy state transfer code... it doesn't seem to work if I use...
0
by: Saverio Tedeschi | last post by:
Hi all gurus, I wrote an Win app with embedded FTP client (well, made some cut and paste from others' projects :-)) to receive and send files from within the app itself. Now the server I connect...
2
by: Sergej Prokoviev | last post by:
We are running our site at www.waynesavings.com on secure hosting (Server 2003, IIS). We are using a custom 403.4 error page (called 403_4.asp, located under root) to redirect all users to https if...
4
by: totalstranger | last post by:
My Bluehost site is setup with a dedicated IP address, Rapid SSL certificate, PHP 5 and FastCGI is set on. When switching between HTTP and HTTPS I was under the impression the Session Data was...
0
by: KyleUbenk | last post by:
Well I have a problem that i want to send a Post Request to a Webproxy site like http://www.cloakme.us/ with the parameter __new_url and a value of another site which I want to login with a ...
0
by: shlim | last post by:
Currently I'm using VB.Net to perform a http/https multipart form post to a servlet. I'm able to perform the post using HttpWebrequest via GetRequestStream(). However, the servlet returned me with...
0
by: kokababu | last post by:
Hi, I have apache http server A and two other machine B and C. B is the production server and C is the test server. Http server A is in separate machine. Now, users will send request via Http...
1
by: jdwfly | last post by:
Just before I go an tell my sys admin that the server has problems I wanted to run this by everyone on here. Basically we have a few pages that need to be sent over https. Everything I have found on...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.