Mvc authorization attribute not working AspNet 6


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.





Josh said:

Is it working?

Posted On: March 03, 2023 21:04:10 PM
Merry said:

Thank you,

Posted On: August 22, 2022 16:30:36 PM

For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email AddressContact: [email protected]