473,406 Members | 2,390 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,406 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 89766
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.