question

jpnddsk-5804 avatar image
0 Votes"
jpnddsk-5804 asked SamWu-MSFT edited

DELETE method return 401 error

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?

windows-server-iisdotnet-aspnet-core-mvc
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SamWu-MSFT avatar image
0 Votes"
SamWu-MSFT answered SamWu-MSFT edited

@jpnddsk-5804

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.

243710-1.png


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.


1.png (20.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

cooldadtx avatar image
0 Votes"
cooldadtx answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.