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

Force entire site HTTPS using Web.Config

I know this can be done in IIS, and it may even be the preferred method
but can someone help me redirect every http request to https? I think
it could be done in the global.asax.cs or web.config but would like to
know the best way first...

Thank you for any help.
Curt

Sep 6 '06 #1
3 11925
<cu**********@gmail.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
>I know this can be done in IIS, and it may even be the preferred method
but can someone help me redirect every http request to https? I think
it could be done in the global.asax.cs or web.config but would like to
know the best way first...
I've never found anything better than this:
http://www.codeproject.com/aspnet/We...id=53615&exp=0
Sep 6 '06 #2
Thanks Mark,

I have this for now, I'll try that next & see if there are any
differences in speed

protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (HttpContext.Current.Request.IsSecureConnection.Eq uals(false))
{
Response.Redirect("https://" + Request.ServerVariables["HTTP_HOST"]
+ HttpContext.Current.Request.RawUrl);
}
}

Mark Rae wrote:
<cu**********@gmail.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
I know this can be done in IIS, and it may even be the preferred method
but can someone help me redirect every http request to https? I think
it could be done in the global.asax.cs or web.config but would like to
know the best way first...

I've never found anything better than this:
http://www.codeproject.com/aspnet/We...id=53615&exp=0
Sep 6 '06 #3
<cu**********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Thanks Mark,

I have this for now, I'll try that next & see if there are any
differences in speed

protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (HttpContext.Current.Request.IsSecureConnection.Eq uals(false))
{
Response.Redirect("https://" + Request.ServerVariables["HTTP_HOST"]
+ HttpContext.Current.Request.RawUrl);
}
}
I'm sure that will work OK for the single requirement that you have, whereas
WebPageSecurity.dll forces individual folders and files to be secure or not
Sep 6 '06 #4

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

Similar topics

0
by: SteveJ | last post by:
All, Can someone help me solve the next step. First of all let me say I'm new to php. I pieced the following code together from samples I found on the net and a book I bought called PHP...
7
by: John McDermidt | last post by:
Is there a way to use HTTPS only on certain pages? I have two pages that I want to use my SSL Cert, but the rest of the files I do not... they are all in the same folder, and I can not move them.
4
by: ronen | last post by:
Hi, There are times when Passport users can sign in, on an ASP.NET site, without being prompted for credentials. This happens, as far as I know, when Passport accounts are stored locally (or...
3
by: JIM.H. | last post by:
Hello, I had my connection string defined in web.config, now I want to have my asp.net application as a secure site with https://, how should I do this? Thanks, Jim.
1
by: Jeff | last post by:
I have an ASP.NET 1.1 Web application that I basically copy and tweak for various clients. It has a login page that is accessible from a dynamically constructed menu that exists in a user control....
2
by: Sergej Prokoviev | last post by:
We are running our site at www.waynesavings.com on secure hosting (Server 2003, IIS). We are using a custom 403.4 error page (called 403_4.asp, located under root) to redirect all users to https if...
1
by: Anonieko | last post by:
> A solution 1. Add a certificate in the site. Check Required SSL (Right click web site->properties->Directory Security->Server Communcations->Edit 2. In IIS manager, right click on...
1
by: steve728 | last post by:
We set up one client in our web Win2000 Server, IIS 5 with a SSL cert. It is http://www.proorthopedic.com. A customer just called to say that a security analysis of his web site advises that his...
0
by: ronscottlangham | last post by:
I have a WCF Web Service that I develop using the ASP.NET Development Server in Visual Studio. In release, the web service will support both HTTP and HTTPS. Initially I had only HTTP configured in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.