Batman.MVC.ActionFilters.RequireSSL.OnActionExecuting C# (CSharp) Method

OnActionExecuting() public method

OnActionExecuting
public OnActionExecuting ( System.Web.Mvc.ActionExecutingContext filterContext ) : void
filterContext System.Web.Mvc.ActionExecutingContext filter context
return void
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            HttpRequestBase Request = filterContext.HttpContext.Request;
            HttpResponseBase Response = filterContext.HttpContext.Response;
            if (!Request.IsSecureConnection && !Request.IsLocal)
            {
                var Builder = new UriBuilder(Request.Url);
                Builder.Scheme = Uri.UriSchemeHttps;
                Response.Redirect(Builder.Uri.ToString());
            }
            base.OnActionExecuting(filterContext);
        }