Question: Why is an Asp.Net Core Authorization attribute not working, I have another Controller that utilizes Authorization and the implementation works pretty well. Why is the other Controller working and the other not?
Login to See the Rest of the Answer
Answer: Look carefully and examine the underlying API the [Authorization] attribute is using, there is a big chance that the Controller that has an Authorization Attribute that is not working is using a System.Web.Http API to Authorize, hence the Controller that has Authorization working usese a "Microsoft.AspNetCore.Authorization", this API works perfectly with the Web Application because the Web Application utilizes AspNetCore API.
You will need to refactor your code after removing the System.Web.Http Namespace from the upper top Class. I hope this helps to resolve your problem.
Another Article Here.
Thank you,
Josh said:
Is it working?