Cannot access a disposed object named "System.Net.TlsStream".

S

SMike

I post this message again as I didn't get an answer back. I would appriciate
any ideas.

I am getting the following error when sending a first https request:

Cannot access a disposed object named "System.Net.TlsStream".

After that everything sems to be fine untill the next long idle period. The
code is below.




Encoding oEnc = System.Text.Encoding.GetEncoding(1252);
oNc = new NetworkCredential(cUserName, cPassWord);

oWebReq = (HttpWebRequest) WebRequest.Create("https://...");
oWebReq.Timeout = 30000;
oWebReq.ContentType = "text/xml";
oWebReq.Method = "POST";
oWebReq.ContentLength = bBuffer.Length;

// -- request ---
oPostStream = oWebReq.GetRequestStream();
oPostStream.Write(bBuffer,0,bBuffer.Length);
oPostStream.Close();

// -- response ---
oWebRes = (HttpWebResponse) oWebReq.GetResponse();

oResStream = new StreamReader(oWebRes.GetResponseStream(),oEnc);
cRes = oResStream.ReadToEnd();
 
G

Guest

SMike,

When do you pass the credential into the oWebReq object? I don't see it here.

Rob Lykens
 
S

SMike

Rob,

The problem is it fails once only after a long time with no activity. First
one fails - the rest of them would work fine until the next long idle
period.

Thank you,
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top