cool breeze
cool breeze

Reputation: 4811

How can I override the Authorize attribute so I can put a breakpoint on it

I am currently doing the following to restrict access to a controller using windows authentication.

[Authorize(Users = @"DOMAIN\first.last")]
public class HomeController : BaseController
{

}

This works fine currently but what I really want to do is:

[Authorize(Roles = @"...")]

But whatever role I entered it didn't work.

I want to set a break-point so I can see which role the currently logged in user has, but I can't do that currently.

Is it possible for me to inherit from Authorize and create my own filter attribute so I can put a break-point in it?

I want to see what role the current user has, so I have to set a breakpoint at the correct spot.

I have this so far:

public class RoleFilter : AuthorizeAttribute
{

}

Upvotes: 0

Views: 432

Answers (1)

Andy T
Andy T

Reputation: 9881

You could create your own (not inherit from AuthorizeAttribute) and just paste in the code that makes up AuthorizeAttribute which you can get from GitHub

Or, you can simply point to the MVC symbol server

Upvotes: 1

Related Questions