473,770 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ 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.ServerV ariables("HTTPS ") = "off" Then

Response.Redire ct("https://" & Request.ServerV ariables("HTTP_ HOST") &
Request.ServerV ariables("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 89938
Bob Hansen wrote:
I am using the following code in my default.asp page to redirect the
page from HTTP to HTTPS

<%

if Request.ServerV ariables("HTTPS ") = "off" Then

Response.Redire ct("https://" &
Request.ServerV ariables("HTTP_ HOST") & Request.ServerV ariables("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.ServerV ariables("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******@NOyah oo.SPAMcom> wrote in message
news:eO******** ******@TK2MSFTN GP09.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.ServerV ariables("HTTPS ") = "off" Then

Response.Redire ct("https://" &
Request.ServerV ariables("HTTP_ HOST") & Request.ServerV ariables("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.ServerV ariables("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************ *********@jasco rp.com> a écrit dans le message
de news:Ol******** *****@TK2MSFTNG P11.phx.gbl...

"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:eO******** ******@TK2MSFTN GP09.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.ServerV ariables("HTTPS ") = "off" Then

Response.Redire ct("https://" &
Request.ServerV ariables("HTTP_ HOST") & Request.ServerV ariables("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.ServerV ariables("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*******@nosp am.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************ *********@jasco rp.com> a écrit dans le message
de news:Ol******** *****@TK2MSFTNG P11.phx.gbl...

"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:eO******** ******@TK2MSFTN GP09.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.ServerV ariables("HTTPS ") = "off" Then
>
> Response.Redire ct("https://" &
> Request.ServerV ariables("HTTP_ HOST") & Request.ServerV ariables("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.ServerV ariables("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.ServerV ariables("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************ *********@jasco rp.com> wrote in message
news:Ol******** *****@TK2MSFTNG P11.phx.gbl...

"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:eO******** ******@TK2MSFTN GP09.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.ServerV ariables("HTTPS ") = "off" Then

Response.Redire ct("https://" &
Request.ServerV ariables("HTTP_ HOST") & Request.ServerV ariables("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.ServerV ariables("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
5196
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 stored in the session. As the user proceeds to checkout, we switch over to https. This is all done on the same physical server, under the same domain (which has an SSL cert). The session ID is carried over fine - I can read the session ID from http...
4
1850
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 response.redirect.
0
1536
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 to from 1st Jan on will allow just http/https connection, so I can no longer use FTP. I've thought to use System.Net.WebClient class and SendFiles method, but when I try only obtain a message, described later in datail. Can pls some1 point me to...
2
4123
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 they come in on http. The site is also using an instant refresh on the index.htm page under root to www.waynesavings.com/aboutus/home.htm due to issues with the javascript menus used on the site. The code we're using on the custom 403 page is...
4
3163
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 independent for each protocol and I've read about various methods of storing session data in a database to bypass this problem. However while testing what I thought was incomplete code (no $_Session preservation code in place), I've discovered this...
0
1800
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 HTTPS POST request to . How do i do it? I know how to do it for just one post request but how do i link them together as such? Because it redirects me to the url i entered.. I hope u understand what im trying to say =/ Any help/points in the right...
0
4107
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 "The remote server returned an error: (500) Internal Server Error". Obviously, this means that I have not posted all the parameters as the servlet requested. But I just can't seem to find out what went wrong with my code. Hope someone can enlighten me,...
0
2139
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 server A to production server B. if any page or link is not found then Http server redirect the link to test server C (test server keeps same contents like B). I don't know how do I do that, Can any one give me any idea?
1
4129
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 the internet resulted in this code If (Request.ServerVariables("HTTPS") = "off") Then srvname = Request.ServerVariables("SERVER_NAME") scrname = Request.ServerVariables("SCRIPT_NAME") Response.Redirect("https://" & srvname & scrname)...
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8929
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7451
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.