473,480 Members | 2,277 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 89821
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
5149
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
1825
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
1500
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
4105
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
3140
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
1748
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
4019
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
2120
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
4090
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
6911
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7050
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
6966
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
5344
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,...
1
4787
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...
0
2988
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.