474,047 Members | 41,517 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.redire ct(https://mysite.com/securepage.asp)
end if
%>

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

"Kenneth Keeley" <ke*******@hotm ail.com> wrote in message
news:e9******** ******@TK2MSFTN GP10.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.S erverVariables( "HTTPS") = "OFF" Then
sDomain = Request.ServerV ariables("SERVE R_NAME")
sPath = Request.ServerV ariables("SCRIP T_NAME")
sQString = Request.Queryst ring
sRedirect = "https://" & sDomain & sPath
If Len(sQString) > 0 Then sRedirect = sRedirect & "?" & sQString
Response.Redire ct 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
20858
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"> which would of course pass it to the file on my normal http site (http://www.mydomain.com). if i wanted this form to pass to my secure site, ie.
12
5227
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...
3
1476
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 add-in for doing this, but I'd like to have this all be our code if possible. Is there a consensus on the best or most common way to switch to/from ssl? I'm thinking if there's a way I can get the absolute URL for something I could then just have a...
1
1660
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 transfer to one of the pages on the secure directory all gets lost. First of all, I had to basically duplicate my web application assembly in the secure folder. I created a "secureWrapper" solution and I added the main web application as a reference,...
2
1638
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 and User). Sometimes what I see happening is that the User session switchs to Admin session and vice versa. The web server is using cookies to communicate session info and I thought this should be relatively foolproof. Any ideas how to prevent...
2
6045
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 switch between them - works perfectly. Setting up which files and/or folders need to run under https is a simple
1
1438
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, while it is fully an HTTPS site, I have tested it on a specific machine and some of the links will stay in HTTPS but others (specifically to the product pages) go to the HTTP protocol. This is not the way it is coded and, in fact, the status bar...
9
2748
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 What are my choices when the website has multiple entry points.
4
1226
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) { frmMain f = new frmMain(); f.show(); }
0
10343
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
12148
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11604
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
12036
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
10316
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
8701
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
6661
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
6841
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4947
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.