Delete identity user in asp net core

preview_player
Показать описание
How to delete IdentityUser from the AspNetUsers database table using the identity api.

Healthy diet is very important for both body and mind. We want to inspire you to cook and eat healthy. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking.

Text version of the video

Slides

ASP.NET Core Text Articles & Slides

ASP.NET Core Tutorial

Angular, JavaScript, jQuery, Dot Net & SQL Playlists

When the Delete button is clicked, the respective user must be deleted from the AspNetUsers table

Deleting data using a GET request is not recommended.

Just imagine what can happen if there is an image tag in a malicious email as shown below. The moment we open the email, the image tries to load and issues a GET request, which would delete the data.

Also, when search engines index your page, they issue a GET request which would delete the data. In general GET request should be free of any side-effects, meaning it should not change the state on the server. Deletes should always be performed using a POST request.

Deleting data using a POST request

Delete button type is set to submit

It is placed inside the form element and the method attibute is set to post

So when the Delete button is clicked a POST request is issued to DeleteUser() action passing it the ID of the user to delete
Рекомендации по теме
Комментарии
Автор

I love that when .Net Core Identity deletes a user it also automatically deletes the associated role assignments for that user.

conaxlearn
Автор

Very good video, like all of the tutorial. I guess it's important for security to head the DeleteUser function with the [HttpPost] attribute. Thank you very much!!!

Alvarolbc
Автор

This is really great, Thanks for all you have done!

rayt
Автор

There should also be a check not to show the currently logged in user in the list with delete button. As we delete user itself we are still logged in

rahulkapoor
Автор

Great tutorial . Sir plz add debugger in code that will give more clearity .

sachingreat
Автор

Thanks as always for that is with quality and detail.

naodagere
Автор

hello Mr.kudvenkat how can i customize Error Messages For Password Complexity In AspNetCore i live in Afghanistan and most people Don't understand English error messages i am really grateful to you

saeednoruzic
Автор

Does the edit button need to be within the form? Or just the delete button? I guess it doesn't matter.

heatherbernstein
Автор

Hello Great Kudvenkat, why did you use form for delete instead of doing it with <a> tag and calling the respective action? regards and thanks very much for your great job.

marconagel
Автор

Why don't we are using other HttpVerbs? As there are many HttpVerbs for specific reason. e.g. DELETE, PUT, PATCH. Everywhere you are only using GET and POST any specific reason that you are not using PUT, DELETE etc.?

mr.trustworthy
Автор

Please make video for soft delete functionality

ranweerkumar
Автор

hy venket can you please makes a tutorial for deleting the employee

MuhammadArslan-vxrv
Автор

Dear can you explain demo parameterized query it prevents sql injection.
I saw your sql tutorials. It's not there.

rk.x
Автор

Your are god for Dotnet trainer and save such human life also like me....

sakthir
Автор

Dear can you make video about asp core with Redis ?

nonatw
Автор

Being able to delete a user without a confirmation prompt is pretty scary. Oops, here comes the solution in the next video. :-)

javaguitarist