473,383 Members | 1,952 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,383 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 89708
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.