I have this Custom Attribute (Custom MVC Authorization):
public class CustomAuthorizeAttribute : AuthorizationFilterAttribute
{
public string Users { get; set; } //its always null!
public override void OnAuthorization(HttpActionContext actionContext)
{
string user = Thread.CurrentPrincipal.Identity.Name.Split('\\')[1];
AdProxy AdProxy = new AdProxy();
if (!AdProxy.IsUserInGroup(user, Users))
{
actionContext.Response = new HttpResponseMessage(HttpStatusCode.Unauthorized);
}
}
}
I use it like this:
[CustomAuthorizeAttribute(Users = "Admin")]
But on debugging the value of "Users" is always null. Any idea?