2X faster development
The ultimate ASP.NET MVC UI toolkit to boost your development speed.
Problem While triggering the deleteAPI in the WebApi sample, the following error is obtained and thus the deleteApi is not called. Server Error in '/' Application. The resource cannot be found. Description HTTP 404. The resource you are looking for, or one of its dependencies, could have been removed, had its name changed, or is temporarily unavailable. Review the following URL and make sure that it is spelled correctly. Requested URL: /api/Orders/10248 Reason When the POST and PUT actions are triggered, no additional parameters are appended to the Route link, that is api/Orders, and so these events are triggered. Refer to the following screenshot.
Figure 1: POST and PUT actions triggered When the DELETE action is triggered, the primary key value is also appended to the Route link, that is, api/Orders/10248. Refer to the following screenshot.
Figure 2: DELETE action triggered Solution Since the Route in the WebApiConfig file does not include the id parameter, the 404 error is thrown. Refer to the following screenshot. Incorrect Example So changing the Route link in the WebApiConfig resolves this error. Correct Example Result: After changing the route in the WebApiConfig.cs file, the deleteApi is called as shown in the following screenshot. Figure 3: Result |
2X faster development
The ultimate ASP.NET MVC UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.