473,320 Members | 1,821 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,320 software developers and data experts.

Redirecting users who use http:// to https://

I have a site that is now SSL secured.

User not still using the http:// to get to the site.

How can I redirect the user the the visited page using https:// ?
Nov 18 '05 #1
3 1489
With SSL you have the option to make the user to have to type the https:// or
not type it in. However, if you make this required then they will see a
default message that they are missing the https://. Now, for just
redirecting user, its the same way. In your link you could type <a
href="https://... OR, in code you can do a response.redirect("https://...")

"Marlon" wrote:
I have a site that is now SSL secured.

User not still using the http:// to get to the site.

How can I redirect the user the the visited page using https:// ?

Nov 18 '05 #2
I use this code to force https://:

if (!Request.Url.ToString().StartsWith("https") &&
!Request.Url.ToString().StartsWith("http://localhost"))
{
Response.Redirect(@"https://www.somepage.com/");
}
"Marlon" <ya********@online.nospam> wrote in message
news:Ok**************@TK2MSFTNGP15.phx.gbl...
I have a site that is now SSL secured.

User not still using the http:// to get to the site.

How can I redirect the user the the visited page using https:// ?

Nov 18 '05 #3
You can add code a custom error handler for the 403.4 error. This error
handler can then replace the "http:" with "https:" and redirect the user
using the https.

Here is a sample:

Dim strURL
Dim iPosition

iPosition = InStr(1,Request.querystring,";")
strURL = replace(Mid(Request.QueryString, iPosition + 1), ":80", "")
iPosition = InStr(1,strURL,"http://")
if iposition = 1 then
strURL = "https://" & mid (strURL, 8)
Response.Redirect strURL
else
Response.Status = "403.4 SSL Required"
end if

jerry

"Marlon" <ya********@online.nospam> wrote in message
news:Ok**************@TK2MSFTNGP15.phx.gbl...
I have a site that is now SSL secured.

User not still using the http:// to get to the site.

How can I redirect the user the the visited page using https:// ?

Nov 19 '05 #4

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

Similar topics

6
by: slash | last post by:
Hi, I am new to JavaScript and I have been sifting through the previous posts about some specific help I need with a redirect problem. No luck there! Could someone take a look and give me some...
2
by: ChrisN | last post by:
Hi there, I have a C# web application. I'm trying to redirect it to another page on my site. Normally I would use: redirect("~/users/userLogin.aspx") The problem is that the...
1
by: mike parr | last post by:
I have been using Response.Redirect("page1.aspx") and Response.Redirect("page2.aspx") to go between pages in the same folder. However, I need to apply https to 1 page within this folder and...
5
by: ChrisN | last post by:
Hi there, Which way of calling pages from within your application is better (ie faster or more efficient)? 1. "~/users/mypage.aspx?" 2. "http://www.mysite.com/users/mypage.aspx" Perhaps...
9
by: Denise | last post by:
I have posted a similar message in 2 other forums but got no response. I have spent more hours than I can count researching this. Can anyone provide some insight...? Our ASP.Net application...
8
by: Morpheus | last post by:
I am trying to test a function that outputs text to the standard output, presumably using a cout call. I do not have access to the source, but need to test the output. Is this possible? I can...
41
by: amygdala | last post by:
Hello all, I have posted a similar question in comp.lang.php in the past, but haven't had any response to it then. I kinda swept the problem under the rug since then. But I would really like to...
9
by: Jonathan Wood | last post by:
I've spent days trying to come up with a solution. I'd appreciate it if anyone can help. My site requires all users to log on. There are three different roles of users, and each user type will...
1
stepterr
by: stepterr | last post by:
All, I'm working on a website that requires SSL enabled on a few pages. The pages are coded in ASP, and I currently have a redirect being called by the pages that require SSL that reloads the page as...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.