Freelance Project Requests Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net

StatusCode: 405, ReasonPhrase: "Method Not Allowed"



Problem: when accessing an Api-Delete interface from WPF on Asp.Net Core MVC, the response StatusCode 405 Method not allowed is returned.


Call from the client side (wpf)

string sURL_Api_Delete = app_settings._Api_Server + "/api/projects/" + sID_on_Server;

                HttpResponseMessage httpResponseMessage = null;



                    httpResponseMessage = await client.DeleteAsync(sURL_Api_Delete);

                    clsSys.fx_Log("ok.Deleted " + sID_on_Server);


                catch (Exception ex)


                    clsSys.fx_Error_Log("Error Delete on Server: : " + ex.Message + "IDProject_on_Server=" + sID_on_Server);


                //</ read webApi >



With the URL

httpResponseMessage = await client.DeleteAsync("");




On the server side

Asp.Net Core Api

//HttpClient-URL: httpDelete /api/projects/5


public async TaskActionResultDelete(int id)


    //-------------< HttpDelete(ID) >------------- 

    //< get UserClaim Info >

    //*get User from Token

    var userClaim_in_Token = HttpContext.User.Claims.Where(c => c.Type == ClaimsIdentity.DefaultNameClaimType).FirstOrDefault(); //User as Name

    if (userClaim_in_Token == null)


        return null;






The return value is completely correct.

The StatusCode 405 and "Method not allowed" comes from the Asp.Net MVC action response BadRequest ().

In this case, it was checked whether the record also belongs to the client.

If both are not equal then the answer: "Method not allowed" is returned

//< check Owner >

long IDOwner = project.IDOwner;

if (IDOwner != IDCurrent_User) { return BadRequest(); }

//</ check Owner >



Json error: A method was called at an unexpected time
StatusCode: 405, ReasonPhrase: Method Not Allowed
Asp WPF: Web API Read Values from Asp Net Api with HttpClient
API: Data Modify and Create with Api Example
Problem ASP.Net: ID is increased by 1000


Contact for Jobs, Project Requests: