locked
Getting error like The requested resource does not support http method 'POST'. in Web Api RRS feed

  • Question

  • User393719 posted

    Hello Sir, Im trying to update the status of 2 tables using web api but getting below error The requested resource does not support http method 'POST'. Please help me Thanks in advance. Below is the web api code

     public Response UpdateUserDeTails(useraccounts userdetails)
        {
            Response response = new Response();
            try
            {
                SqlCommand cmd = new SqlCommand("update table1 t1 join table2 t2 on t1.userId = t2.userId set t1.status = " + 0 + ", t2.status = " + 0 + " where t1.userId = @userId", con);
                cmd.Parameters.AddWithValue("@userId", userdetails.userId);
                con.Open();
                int i = cmd.ExecuteNonQuery();
                con.Close();
                if (i >= 1)
                {
                    response.Message = "User details deleted successfully";
                    response.Status = 1;
                }
                else
                {
                    response.Message = "Failed to save";
                    response.Status = 0;
                }
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                response.Status = 0;
    
            }
            return response;
        }
    
    Friday, August 7, 2020 6:11 AM

All replies

  • User377758 posted

    What's your code about the http request ? And you can first use PostMan to test your web api. You can find more detail about this question when you post the http request.

    Friday, August 7, 2020 9:35 AM