Why is a cert going to fix the redirection for him? Thanks,
Shawn Wildermuth http://adoguy.com http://wildermuthconsulting.com http://geekdinners.com Microsoft MVP (C#), MCSD.NET, Author and Speaker The Silverlight Tour is coming to a city near you! -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of John Warner Sent: Saturday, May 17, 2008 7:09 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] HTTPS Importance: Low Get a certificate. John Warner > -----Original Message----- > From: Discussion of advanced .NET topics. [mailto:ADVANCED- > [EMAIL PROTECTED] On Behalf Of Paul Cowan > Sent: Saturday, May 17, 2008 6:25 PM > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: [ADVANCED-DOTNET] HTTPS > > Hi, > > I am using the ASP.NET MVC framework and I need to have our site running > under HTTPS. > > I have the an HTTP module with the following code running: > > public void Init(HttpApplication application) > { > _currentApplication = application; > > if (!Continuity2Config.Settings.IsLive) > return; > > _preserve = Continuity2Config.Settings.PreserveSSL; > > application.BeginRequest += application_BeginRequest; > _log.Error("HTTPS HttpModule has initialised."); > } > > protected void application_BeginRequest(object sender, EventArgs e) > { > HttpApplication application = (HttpApplication)sender; > _currentUri = application.Context.Request.Url; > > > if ( _preserve && !application.Context.Request.IsSecureConnection) > { > TransferToHttps(); > } > } > > > private void TransferToHttps() > { > _currentApplication.Context.Response.Redirect > (_currentUri.AbsoluteUri.Replace("http://", "https://"), false); > _log.Error("HTTPS Redirect=" + _currentUri.AbsoluteUri.Replace > ("http://", "https://")); > } > > Basically I am redirecting all requests that come in from HTTP to HTTPS. > > My code just does not seem right. > > Surely there is a better way of doing this? > > Thanks > > Paul > > =================================== > This list is hosted by DevelopMentorR http://www.develop.com > > View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor. http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com