[Mono-devel-list] Trouble with HttpWebResponse

Peter Magnusson kmpm_se at msn.com
Mon Mar 3 13:54:05 EST 2003


At first I thougt I had some trouble with System.IO.StreamReader.ReadToEnd 
but it seems that there is trouble elsewhere..
The test described below works fine with Microsoft .NET SDK and the csc 
compiler but it doesn't work with mono, at least not in SuSE 8.1 Pro.

The failing configurationen uses
SuSE Linux 8.1 Pro
Mono-0.21, mcs-0.21
Compaq Evo N800c (P4 1.7 MHz, 392 MB Ram)

The working configuration uses
Windows XP Pro SP1
Visual Studio .NET 2002 Ent. Arc.
(mono isn't installed in windows)
Compaq Evo N800c (P4 1.7 MHz, 392 MB Ram)


===== Test Begin ======
using System;
using System.IO;
using System.Text;
using System.Net;


class TestWebResponseStream
{
  static void Main (string [] args)
  {
    HttpWebRequest myReq = 
(HttpWebRequest)WebRequest.Create("http://www.go-mono.com");
    myReq.UserAgent="Mozilla/4.0 (compatible; monoWebResponseTest)";
    try
      {
	HttpWebResponse myRes = (HttpWebResponse)myReq.GetResponse();
	Stream respStream = myRes.GetResponseStream();
	int respLength=(int)myRes.ContentLength;

	StreamReader reader =
		     new StreamReader(respStream, Encoding.ASCII,true,respLength);

	Console.WriteLine("Works to here");
	Console.WriteLine(reader.ReadToEnd());
	myRes.Close();

      }
    finally { }
    }
}

===== Test End ======

Peter Magnusson
mail:kmpm_se at msn.com



_________________________________________________________________
Skaffa fler messengerkontakter - Vinn 10.000 i resecheckar! 
http://messenger.msn.se/promo




More information about the Mono-devel-list mailing list