473,405 Members | 2,272 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,405 software developers and data experts.

Switching Between HTTP and HTTPS

Hi
I wish to have a web site that has most of the pages as normal HTTP pages
but has some areas that use HTTPS. I want to have it that if a user selects
a link to a HTTPS page that they go there an there Session Information is
kept. I also wish to have the pages switch automatically to HTTPS if a
visitor types the URL without the HTTPS. So my questions are:
1) How to redirect to a Secure Page without losing Session Info?
2) How to test if page is accessed by HTTPS, and if not switch to HTTPS
quickly?

I think something like this code is what I want but how do I do it.

<%
if not "HTTPS" then
response.redirect(https://mysite.com/securepage.asp)
end if
%>

Thanks for the help.
Kenneth Keeley
Jul 19 '05 #1
1 9201

"Kenneth Keeley" <ke*******@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
So my questions are:
1) How to redirect to a Secure Page without losing Session Info?
This is not possible. Sessions cannot be maintained across different
protocols. You'll have to store the info server-side in a database, for
example.
2) How to test if page is accessed by HTTPS, and if not switch to HTTPS quickly?


Here's an example:
http://www.aspfaq.com/2321

You'd probably also want to grab the querystring, should it exist. Maybe do
it like this instead (illustrative example):

<%
Dim sRedirect, sDomain, sPath, sQString
If UCase(Request.ServerVariables("HTTPS") = "OFF" Then
sDomain = Request.ServerVariables("SERVER_NAME")
sPath = Request.ServerVariables("SCRIPT_NAME")
sQString = Request.Querystring
sRedirect = "https://" & sDomain & sPath
If Len(sQString) > 0 Then sRedirect = sRedirect & "?" & sQString
Response.Redirect sRedirect
End If
%>
Ray at home
Jul 19 '05 #2

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

Similar topics

1
by: fartsniff | last post by:
hello all. currently, this is how a line of my form is setup (names have been changed to protect the innocent ;) <form action="/modules.php?name=buyme&file=index&func=gimmecash" method="post">...
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...
3
by: MattB | last post by:
I've seen some different suggestions about this, and I'm wondering if there's a common way to do it. I have an app I'll be distributing, so we can't hardcode a absolute URL in it. I've seen an...
1
by: Iulian Ionescu | last post by:
I have a page (http://www.something.com/) and a secure page (https://secure.something.com) and the secure.something.com points to http://www.something.com/secure/ All works ok, but, when I...
2
by: Slav | last post by:
Hello, I am using multiple instances of IE on the same machine to test a web site I've created. The web site can be accessed by multiple user type each with different access rights (e.g. Admin...
2
by: Mark Rae | last post by:
Hi, I'm presently upgrading a v1.1 ASP.NET app to v2. Parts of site run under SSL and parts don't, and the site uses this code: http://www.codeproject.com/aspnet/WebPageSecurity.asp to...
1
by: cbright | last post by:
I have a very weird problem with our site at https://store.canoegame.com. For many users the site is working as it should however for a few it is not. One of the bigger problems is the fact that,...
9
by: LVP | last post by:
Hello, What are the ways to switch from http to https. Is there a way internal to IIS 6.0 or x.xx? Some configuration? Is there a way via DNS? I have seen Scripts in VB and JavaScript ...
4
by: bob | last post by:
Hi, Newbie question. I have a logon Web Form which, once the server has validated the logon, I want to open up a main form. i.e. In a windows app I would write something like if(logon) {...
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
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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.