DELETE method return 401 error

jpnddsk 46 Reputation points

Hi all,

I have a .net core mvc application published on iis and when i use delete request i get 401 Unauthorized Error.

Can someone help me fix it?

Internet Information Services
A set of technologies in the .NET Framework for building web applications and XML web services.
4,226 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sam Wu-MSFT 7,046 Reputation points Microsoft Vendor


    I found a case with the same problem as yours on stackoverflow, you can try this solution:

    Enable delete verb on the iis server -> .NET Authorization Rules.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Michael Taylor 49,071 Reputation points

    Not sure what you want us to help you with here. 401 means you are attempting to do something you don't have permission to do. Since you wrote the code you should verify that the code that calls this API is passing whatever user credentials your app uses. You should then look at the corresponding action on the server side and ensure you're getting the credentials. If this is the only place you are having this issue but you require authentication for all other endpoints then the problem is with the calling code. If none of your endpoints work then it would be a deployment issue I'd wager.

    If you want us to help you further you're going to need to provide us some code such as how you're delete action is defined, the auth setup, the client code calling the API and any pertinent information about how your app and IIS are configured for authentication.

    0 comments No comments