"The underlying connection was closed: An unexpected error occurred on a receive."
hii,
i have the same problem as you. please see this page first for the main problem in .NET web.services :
http://support.microsoft.com/default...en-us%3b819450
well i added thos recommended code but it still has the same error in my program so i add some code and it's works, try this :
private string requestpost(String TheURL,string postdata, String TheProxy)
{
Uri uri = new Uri(TheURL);
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uri);
string page;
try
{
string postsourcedata=postdata;
// start added codes
request.KeepAlive = false;
request.ProtocolVersion=HttpVersion.Version10;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postsourcedata.Length;
request.Proxy = System.Net.WebProxy.GetDefaultProxy();
request.AllowAutoRedirect=true;
request.MaximumAutomaticRedirections=10;
request.Timeout=(int) new TimeSpan(0,0,60).TotalMilliseconds;
request.UserAgent="Mozilla/3.0 (compatible; My Browser/1.0)";
// end added codes
Stream writeStream = request.GetRequestStream();
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(postsourcedata );
writeStream.Write(bytes, 0, bytes.Length);
writeStream.Close();
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader readStream = new StreamReader (responseStream, Encoding.UTF8);
page = readStream.ReadToEnd();
}
catch (Exception ee)
{
page = "fail!";
}
return page;
}
hopefully your troubled solved..
regards,
-xins.
(by the way have u watch LORD OF THE RING : RETURN OF THE KING?)
:)
See u in matrix