I'm trying to perform a put operation on asp.net mvc, but it gives me a bug in:
var response = (HttpWebResponse)httpWebRequest.GetResponse();
This is the bug: {"Error on the remote server: (404) Could not be found."}
Here I leave the code to see if anyone knows why this failure
HttpWebRequest httpWebRequest =(HttpWebRequest)WebRequest.Create(apiUrl);
httpWebRequest.Credentials = CredentialCache.DefaultCredentials;
httpWebRequest.ContentType = metodo.ContentType;
httpWebRequest.Accept = "application/json";
httpWebRequest.Method = "PUT";
JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
string jsonData = jsSerializer.Serialize(datosPUT);
byte[] arrData = Encoding.UTF8.GetBytes(jsonData);
httpWebRequest.ContentLength = arrData.Length;
Stream dataStream = httpWebRequest.GetRequestStream();
dataStream.Write(arrData, 0, arrData.Length);
dataStream.Close ();
var response = (HttpWebResponse)httpWebRequest.GetResponse(); //Fallo
var reader = new StreamReader(response.GetResponseStream());
But nevertheless in another plantarforma test in front of the same server if it works, the bad thing that I do not have access to it