I've been meddling a bit with Authorization for a while and found a few pages that helped me override the default methods. However, it seems that I cannot get the attribute to work. I debug my project with Visual Studio 2013 and yet it still does not stop at the breakpoint where the Authorize method is redifined. This wouldn't be an issue if the web services worked after placing the [Authorize] over the class or even individual methods. I've tried them all yet it seems that everything it returns is 401 Unauthorized. It doesn't even enter the desired Web service either. Here is a few samples to explain my problem:
[Authorize]
[RoutePrefix("api/MyWS")]
public class MyWSController : ApiController
{
private Test_UnitOfWork unitOfWork = new Test_UnitOfWork();
[Route("Get"), HttpGet]
public IEnumerable<MyWS> Get()
{
return unitOfWork.MyWSRepository.Get().OrderBy(s => s.Name);
}
Redefinition of OnAuthorization method
public class TokenValidationAttribute : System.Web.Http.AuthorizeAttribute
{
public override void OnAuthorization(HttpActionContext actionContext)
{ ...
Controller calling the web service
MyWSlist = client.GetSync<IList<MyWS>>("MyWS");
I'd like to know what I'm doing wrong here, seeing as whenever I try to debug my project, I can't seem to enter the rewriten code at all, it just returns the Unauthorized error. I've also tried to rewrite the other methods but no dice. Regards