Thursday, October 27, 2016

Did you know there is an OnException action filter in MVC?

It's a lot like the OnAuthorization action filter...

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Something.Models;
namespace Something.Controllers
{
   public class HomeController : Controller
   {
      protected override void OnAuthorization(AuthorizationContext filterContext)
      {
         
//whatever
      }
      
      protected override void OnException(ExceptionContext filterContext)
      {
         
//whatever
      }

 
 

...and these four characters. It's one of the six filtering methods one may use at a controller.

No comments:

Post a Comment