sometimes get error when connecting

leontager

Regular
Joined
Jun 17, 2003
Messages
89
Hi i get the following error but only sometimes

The underlying connection was closed: An unexpected error occurred on a send.

when i connect to some website using the following code

System.Net.WebClient client = new System.Net.WebClient();
System.Collections.Specialized.NameValueCollection names;
byte[] response;
names = new System.Collections.Specialized.NameValueCollection();
client.Headers.Add("User-Agent", "MSIE 6.0");
names.Add("username",user);
names.Add("password",pass);
response = client.UploadValues(address, "POST", names);


I get the error on the last line.
Does anyone know how to solve it?
 
Back
Top