473,472 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

detecting SSL or not

Hi,

I have a web site i want to be SSL (we already have the cert and everything
from verisign) but i want port 80 to redirect to the ssl connection 443
(HTTPS) so if they go to the site at http://site it will determin hey im not
ssl and redirct to https://site how would you do this? thanks
Nov 18 '05 #1
5 2307
On 7/21/2004 9:53 AM, Brian Henry wrote:
Hi,

I have a web site i want to be SSL (we already have the cert and everything
from verisign) but i want port 80 to redirect to the ssl connection 443
(HTTPS) so if they go to the site at http://site it will determin hey im not
ssl and redirct to https://site how would you do this? thanks


you have to detect SSL, and then construct the https://... url yourself
(no automated way I know of to do that OOTB, someone may have written a
utility class to do this somewhere). The easiest way to detect is to
check if Request.Url.Scheme is equal to System.Uri.UriSchemeHttps or
System.Uri.UriSchemeHttp. Then build the new https URL yourself (if
needed).

Here's a posting that answered this, also has an example of switching to
SSL in old ASP:
http://www.dotnet247.com/247referenc...31/156879.aspx

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #2
The "HTTPS" key within the Server object should tell you whether SSL is
being used or not. If this doesn't work for you, then use the "SERVER_PORT"
or "SERVER_PORT_SECURE" keys within the Server object.

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:ef**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a web site i want to be SSL (we already have the cert and everything from verisign) but i want port 80 to redirect to the ssl connection 443
(HTTPS) so if they go to the site at http://site it will determin hey im not ssl and redirct to https://site how would you do this? thanks

Nov 18 '05 #3
thanks

"ASP.Confused" <anonymous@> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
The "HTTPS" key within the Server object should tell you whether SSL is
being used or not. If this doesn't work for you, then use the "SERVER_PORT" or "SERVER_PORT_SECURE" keys within the Server object.

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:ef**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a web site i want to be SSL (we already have the cert and

everything
from verisign) but i want port 80 to redirect to the ssl connection 443
(HTTPS) so if they go to the site at http://site it will determin hey im

not
ssl and redirct to https://site how would you do this? thanks


Nov 18 '05 #4
Thanks for all the suggestions.

Hi Brian,

Here are some other tech articles in codeproject discussing the redirecting
from http to https processing in asp.net, the author has built a custom
module to perform this function:

#Switching Between HTTP and HTTPS Automatically
http://www.codeproject.com/aspnet/WebPageSecurity.asp

#Switching Between HTTP and HTTPS Automatically: Version 2
http://www.codeproject.com/useritems...ecurity_v2.asp

Hope also helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #5
Here's a user control that I made that works quite well. All you have to
do is include it in the pages that you want to ensure SSL with...
<%@ Control language="c#" %>
<script runat="server">
public void Page_Load(object sender, System.EventArgs e)
{
if (!Request.IsSecureConnection)
{
string strSecureURL = "https://";
strSecureURL += Request.ServerVariables["SERVER_NAME"];
// strSecureURL += Request.ServerVariables["URL"];
strSecureURL += Request.RawUrl;
Response.Redirect(strSecureURL);
}
}
</script>

Shan Plourde

Brian Henry wrote:
thanks

"ASP.Confused" <anonymous@> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...

The "HTTPS" key within the Server object should tell you whether SSL is
being used or not. If this doesn't work for you, then use the

"SERVER_PORT"

or "SERVER_PORT_SECURE" keys within the Server object.

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:ef**************@TK2MSFTNGP12.phx.gbl...

Hi,

I have a web site i want to be SSL (we already have the cert and

everything

from verisign) but i want port 80 to redirect to the ssl connection 443
(HTTPS) so if they go to the site at http://site it will determin hey im

not

ssl and redirct to https://site how would you do this? thanks




Nov 18 '05 #6

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

Similar topics

5
by: Jole | last post by:
Hi I'm writing a program that needs to read from a file. In order for the program to be robust, it should somehow check that the file isn't corrupt, or stuffed in any way. For example, that...
15
by: Jay | last post by:
I'm sure this is a really dumb question, but how do you detect a variable type in Python? For example, I want to know if the variable "a" is a list of strings or a single string. How do I do...
3
by: raptor | last post by:
hi, how to detect opera..it seems that even opera8 doesnt support xmlhttp fully (.i.e. sendRequestHeader). I ask this 'cause opera seems to mimic IE, at least in the preferences ?! I havent...
9
by: D. Shane Fowlkes | last post by:
I'm using SQL Server 2000 and on my page, I'm simply creating a SQLDataReader and filling in Labels with the retrieved (single) record. However, how can I prevent from getting errors when a field...
3
by: regtrashcan | last post by:
I have a webpage that detects whether Shockwave Player is installed and the version number. The javascript/vbscript that I use has worked fine until the latest release of the Shockwave Player. I am...
79
by: VK | last post by:
I wandering about the common proctice of some UA's producers to spoof the UA string to pretend to be another browser (most often IE). Shouldn't it be considered as a trademark violation of the...
5
by: Z.K. | last post by:
In C#, using the StreamReader, how do I detect when you get to the end of line. I am reading a text file using the Read() function and I need to detect the \n\r, but everything I try does not...
1
by: wwwords | last post by:
Is there a general method for detecting that a user has changed the record currently visible on a form, whether this is by hitting PgUp or PgDn or clicking on a navigation button, even if no change...
15
by: RobG | last post by:
When using createEvent, an eventType parameter must be provided as an argument. This can be one of those specified in DOM 2 or 3 Events, or it might be a proprietary eventType. My problem is...
1
by: davidson1 | last post by:
Hello Friends, I am using HP Laptop.I have a MP3 Player.I used to charge it using my laptop(Windows XP).But Nowadays it is not detecting and charging whenever I connect MP3 Player...
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
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,...
0
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...
0
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,...
1
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...
0
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...
0
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
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.