[Mono-list] Bug in StreamWriter ??? (Mono 1.2.5 on Windows XP) ??

Andrew Tierney andrew at castlesoft.com.au
Thu Sep 6 02:02:22 EDT 2007


Hi All,

I just tested a little VOIP account checker I had running on .NET 2.0 
and it appears to crash on Mono 1.2.5.

The code snippet in question is as follows: (basically go to the login 
page, post details then save cookies and reply...)

================================================================================

            string VOIPPage = 
"https://billing.sipme.com.au:8445/login.html";
            string VOIPPOST = "user=USERID&password=MYPASSWORD&x=27&y=12";
        
            HttpWebRequest req = 
(HttpWebRequest)WebRequest.Create(VOIPPage);
            req.Method = "POST";
            req.CookieContainer = new CookieContainer();
            req.ContentType = "application/x-www-form-urlencoded";
            req.ContentLength = VOIPPOST.Length;
            StreamWriter sw = new StreamWriter(req.GetRequestStream());
            sw.Write(VOIPPOST);
            sw.Close();   // <<<==== CRASHES HERE..on MONO ??????

            HttpWebResponse postRes = (HttpWebResponse)req.GetResponse();
            StreamReader sr = new StreamReader(postRes.GetResponseStream());
            string reply = sr.ReadToEnd();

======================================================================

The Error when I run this on MONO 1.2.5 is:

Unhandled Exception: System.Net.WebException: Error writing request.
  at System.Net.WebConnectionStream.WriteRequest () [0x00000]
  at System.Net.WebConnectionStream.Close () [0x00000]
  at System.IO.StreamWriter.Dispose (Boolean disposing) [0x00000]
  at System.IO.StreamWriter.Close () [0x00000]
  at Voip.Program.Main (System.String[] args) [0x00000]

It works fine on .NET 2.0 on Windows XP Sp2..

Any ideas ??

Regards
Andrew



            





More information about the Mono-list mailing list