I have a custom Authorization attribute not getting called in my asp.net class and I can't tell what I'm missing.
My Attribute looks like this:
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class MyAuthorize : System.Web.Http.AuthorizeAttribute
{
public override void OnAuthorization(HttpActionContext actionContext)
{
// ...
}
protected bool AuthorizeCore(HttpContextBase httpContext)
{
// Logic here.
return false;
}
}
And I'm calling it from inside a WebService like so:
[WebService(Namespace = "http://something/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class AccessPoint : System.Web.Services.WebService
{
[WebMethod]
[MyAuthorize]
public bool SomeWebMethod(int a)
{
//Do stuff
return false;
}
}
Each time I run it, it will fall right through and never trigger the attribute. FYI; I used System.Web.Http.AuthorizeAttribute because System.Web.Mvc.AuthorizeAttribute was telling me that AuthorizeAttribute did not exist.