I used the top answer from HTTP request with post however an error pops up in visual studio saying 404 remote server not found.
The website exists, it is a rails app bounded to the ip address of my router. Using the following url in the browser updates the attribute of the applicant entity in the rails app. However using the c# app to do this is not working.
http://<ADDRESS HERE>:3000/api/v1/applicants/update?id=2&door=true
I have the ff:
using System.IO;
using System.Net;
using System.Text;
I used the following code inside a btn click
private void button1_Click (object sender, EventArgs e){
var request = (HttpWebRequest)WebRequest.Create("http://<ADDRESS HERE>:3000/api/v1/applicants/update");
var postData = "id=2";
postData += "&door=true";
var data = Encoding.ASCII.GetBytes(postData);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
}