protected override void OnAuthorization(AuthorizationContext filterContext) { //the NopHttpsRequirement set on the Controller Action will handle redirecting to Https. // We just need to handle any requests that are already under SSL but should not be. if (Request.IsSecureConnection) { Boolean requireHttps = false; requireHttps = filterContext.ActionDescriptor.GetCustomAttributes(typeof(NopHttpsRequirementAttribute), false).Length >= 1; //If this request is under ssl but yet the controller action // does not require it, then redirect to the http version. if (!requireHttps && !filterContext.IsChildAction) { UriBuilder uriBuilder = new UriBuilder(Request.Url); //change the scheme uriBuilder.Scheme = "http"; uriBuilder.Port = 80; filterContext.Result = this.Redirect(uriBuilder.Uri.AbsoluteUri); } } base.OnAuthorization(filterContext); }