string UploadCSVString = @"StockNumber,Shape,Weight,Color,Clarity"
+
Environment.NewLine + "1234Eli,Round,2.0,F,VVS1";
string URLAuth = "https://technet.rapaport.com/HTTP/Authenticate.aspx";
WebClient webClient = new WebClient();
NameValueCollection formData =
new NameValueCollection();
formData["Username"] = "myUser";
formData["Password"] = "myPassword";
byte[] responseBytes = webClient.UploadValues(URLAuth,
"POST", formData);
string ResultAuthTicket = Encoding.UTF8.GetString(responseBytes);
webClient.Dispose();
string URL = "http://technet.rapaport.com/HTTP/Upload/Upload.aspx?Method=string";
formData.Clear();
formData["ticket"] = ResultAuthTicket;
formData["UploadCSVString"] = UploadCSVString;
formData["ReplaceAll"] = "false";
responseBytes = webClient.UploadValues(URL, "POST",
formData);
string Result = Encoding.UTF8.GetString(responseBytes);
|