0
Reply

The remote server returned an error: (503) Server Unavailable.

Seamus Cummins

Seamus Cummins

Feb 6 2006 12:27 PM
6k
I am trying to connect to a Unix Box which is running a HTTP server using the code below. the location of a file I want to download is (example) http://wm2t.wload.xxxx.co.uk:41921/yyyyy/ls-txt.pl?dir=app/big0c/I2/print/sa and when I paste this address into Internet Explorter it displays the file no problem. When I try to do it from a Windows app with this code howvere I get The remote server returned an error: (503) Server Unavailable. try { // HttpWebRequest request = (HttpWebRequest)WebRequest.Create ("http://www.microsoft.com "); HttpWebRequest request = (HttpWebRequest)WebRequest.Create (textBox1.Text.ToString()); //The Method property can be set to any of the HTTP 1.1 protocol verbs: GET, HEAD, POST, PUT, DELETE, TRACE, or OPTIONS. request.Method="GET"; request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"; request.KeepAlive = true; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); String ver = response.ProtocolVersion.ToString(); StreamReader reader = new StreamReader(response.GetResponseStream() ); string str = reader.ReadLine(); while(str != null) { Console.WriteLine(str); str = reader.ReadLine(); }