I have below curl request that I want to convert to C# code. I'm just not sure what is the equivalent of "--data-binary" in HttpWebRequest.
curl -s -H "Content-Type:application/xml" -X POST --data-binary @C:\path\to\file.xml "https://somerestURL?create"
So far, below is my code:
var xmlFile = "C:\\path\\to\\file.xml";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
NetworkCredential cred = new NetworkCredential(uname, cipher);
CredentialCache cache = new CredentialCache { { url, "Basic", cred } };
request.PreAuthenticate = true;
request.Credentials = cache;
request.Method = "POST";
request.ContentType = "application/xml";
I can provide information if you need more. Thank you.