IIS Server Security - Redirecting users who use http:// to https://

This is Interesting: Free IT Magazines  
Home > Archive > IIS Server Security > May 2005 > Redirecting users who use http:// to https://





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

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

2004-12-01, 7:48 am

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:// ?


Tampa .NET Koder

2004-12-01, 7:48 am

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:// ?
>
>
>

Eirik Eldorsen

2004-12-01, 5:57 pm

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" <yardi4life@online.nospam> wrote in message
news:OkwPNq61EHA.3236@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:// ?
>



WenJun Zhang[msft]

2004-12-02, 3:57 am

Hi Marlon,

Please check my reply of your thread in IIS newsgroup. Thanks.

Best regards,

WenJun Zhang
Microsoft Online Support
This posting is provided "AS IS" with no warranties, and confers no
rights.
Get Secure! - www.microsoft.com/security

JerryK

2004-12-09, 6:19 pm

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" <yardi4life@online.nospam> wrote in message
news:OkwPNq61EHA.3236@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:// ?
>



jarvis meier

2005-05-30, 5:52 pm

private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.Request.IsSecureConnection)
{
Response.Redirect("https://secure url here");
}
}

*** Sent via Developersdex http://www.codecomments.com ***
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com