1

I'm trying to make a delete user route, but i can't get it to work.
Everything I find online is for .NET CORE.
I use ASP.NET MVC. So I ran routes.MapMvcAttributeRoutes() in RouteConfig.cs.
I than create a controller extending System.Web.Mvc.Controller. (Everything comes from the System.Web.Mvc namespace).

And I have the following method:

[HttpDelete, Route("user/{id:long}")]
public async Task<ActionResult> Destroy(long id)
{
    IAccountService accountService = new AccountService();

    bool success = await accountService.Delete(id);

    return Json(new AuthenticateDto());
}

Rearranging the attributes doesn't work (I'm new to attributes so idk if it even helps)
When I try to visit the url i receive a 404.

Anyone has a clue, why it does not work?

0 Answers0