public static void RedirectToLoginPageOnAuthenticationErrors() { var exc = HttpContext.Current.Server.GetLastError(); if (exc is TokenExpiredException || exc is InvalidIPException || exc is WebAuthCookieNotFoundException) { var auth = new Auth(); auth.RemoveToken(); HttpContext.Current.Response.Redirect(string.Format( "{0}?ReturnUrl={1}", WebAuthSettings.LoginUrl, HttpContext.Current.Server.UrlEncode( HttpContext.Current.Request.RawUrl)) ); } }
public override void OnAuthorization(AuthorizationContext filterContext) { var auth = new Auth(); auth.RefreshToken(DateTime.Now.AddDays(2)); }