469,641 Members | 1,134 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,641 developers. It's quick & easy.

Unable to write data to remote HTTPS server

Hi All,
I am getting lot of
System.IO.IOException: Unable to write data to the transport
exceptions when I write to a Stream which is connected to a Remote
HTTPS server using a proxy and a certificate.

ASCIIEncoding encoding = new ASCIIEncoding();
byte[] data = encoding.GetBytes(..........);

HttpWebRequest req = (HttpWebRequest) WebRequest.Create(m_url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = data.Length;
req.Proxy = new WebProxy( ...........);
req.Credentials = new NetworkCredential(..........);

Stream reqStream = req.GetRequestStream();
reqStream.Write(data, 0, data.Length); // THROWS IOException here

The exception is thrown in almost 50% of the write request throughout
the day. Here is the exception I get.

System.IO.IOException: Unable to write data to the transport
at System.Net.TlsStream.InnerWrite(Boolean async, Byte[] buffer,
Int32 offset
, Int32 size, AsyncCallback asyncCallback, Object asyncState)
at System.Net.TlsStream.BeginWrite(Byte[] buffer, Int32 offset,
Int32 size, A
syncCallback asyncCallback, Object asyncState)
at System.Net.Connection.BeginWrite(Byte[] buffer, Int32 offset,
Int32 size,
AsyncCallback callback, Object state)
at System.Net.ConnectStream.BeginWrite(Byte[] buffer, Int32 offset,
Int32 siz
e, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32
at NASDTrace.MyHttpResource.GetFile()

Thanks in advance.

Nov 17 '05 #1
1 2206
I fixed it by adding a line of code.

System.Net.ServicePointManager.Expect100Continue = false;

For details, see the link


Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by SleepingRabbit | last post: by
16 posts views Thread by Serdar Kalaycý | last post: by
5 posts views Thread by Charlie King | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.