> Hi all,I have a site that needs to run over HTTPS. I have installed the > certificate on the server and I can access the site over HTTPS. > The problem is that I can still hit the site over HTTP. > How can I ensure that the all HTTP requests will be redirected to HTTP? > > Can I do it without code or do I have to write an HTTP Module or > something.Thanks > [EMAIL PROTECTED] > _________________________________________________________________
You could configure the server to not accept requests over port 80 for those locations (i.e. require SSL) Or you could write a HTTPModule that checks the protocol is https and if not redirects to the equivalent https URL Something like: public class SSLModule :IHttpModule { public void Dispose() {} public void Init(HttpApplication context) { context.BeginRequest += new EventHandler(context_BeginRequest); } void context_BeginRequest(object sender, EventArgs e) { HttpRequest request = ((HttpApplication)sender).Request; HttpResponse response = ((HttpApplication)sender).Response; if (!request.IsSecureConnection && !request.IsLocal) { response.Redirect(request.Url.ToString().Replace("http://", "https://")); } } } =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com