If i have an Area in my ASP.NET MVC 3 (Razor) Web application, where all controllers derive from a base controller that looks like this:
[Authorize(Roles="Administrator")]
public class AdminController : Controller
{
}
When a non-administrator tries to access a URL in that area, they get redirected to the login page specified in the web.config.
But this doesn't really make sense if the user is already authenticated, but not an administrator. In that scenario, shouldn't we be returned a HTTP 401?
My question is basically how do people handle this - do they create custom authorize attributes?