I wrote a c# desktop app that use webrequest/response to post large records to a remote website.
when i test the app locally, specifying my localhost site as my url, the app works fine but when i try to connect to a remote (live) website the application becomes very slow:it takes more than two days to upload 2,000 records.
Please I need a more reliable and faster way to send this records.
(n.b.:I am using Backgroundworker to multithread)
below is a copy of my code:
<pre lang="cs">public string PostDataToWeb(string postData, string url)
WebRequest request = WebRequest.Create(url);
request.Method = "POST";
byte byteArray = Encoding.UTF8.GetBytes(postData);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
using (Stream dataStream = request.GetRequestStream())
dataStream.Write(byteArray, 0, byteArray.Length);
using (WebResponse response = request.GetResponse())
retu = (((HttpWebResponse)response).StatusDescription);
I now included the above method in a loop that loop through a datatable for all the records and send them row by row.
thanks in anticipation.