public ActionResult SignIn() { this.ControllerContext.HttpContext.User = CustomAuth.GetFakeUser(); if (User.Identity.IsAuthenticated) { return(RedirectToAction("Index", "Dashboard")); } else { return(RedirectToAction("Index", "Dashboard")); //return View(); } }
// Require HTTPS for all requests processed by ASP.NET protected void Application_BeginRequest(Object sender, EventArgs e) { Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = GetSelectedCulture(); this.Request.RequestContext.HttpContext.User = CustomAuth.GetFakeUser(); if (Context.Request.IsSecureConnection) { // HSTS blocks access to sites with invalid certs bool usingValidTlsCert = false; // tell the browser that this site is ALWAYS https (but only if the cert is valid!) if (usingValidTlsCert) { // note: to clear this from a browser, set the header with "max-age=0" Response.AddHeader("Strict-Transport-Security", "max-age=3600"); } } else { // (if we are serving HTTP) redirect users to HTTPS Response.RedirectPermanent(Context.Request.Url.ToString().Replace("http://", "https://"), false); CompleteRequest(); } }