コード例 #1
0
 public void OnException(ExceptionContext context)
 {
     if (context.Exception is UnauthorizedRequestException)
     {
         var logger = context.Service <ILogger <UnauthorizedRequestFilter> >();
         logger.LogWarning(context.Exception.Message);
         var result = new RedirectToActionResult("LogIn", "Account",
                                                 new RouteValueDictionary(new
         {
             returnUrl = context.HttpContext.Request.Path
         }));
         context.Result = result;
     }
 }