Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 17, 2007 12:55 AM by Young Fang - MSFT
Jan 15, 2007 04:43 PM|LINK
I'm not sure if this is the right place to post this...
The thing is that I'm trying to fetch a Xml file from a url coz I don't want to save it everytime a post is made.
But when I do this, it gives me the following error: The remote server returned an error: (503) Server Unavailable.
I would appreciate any help.
Jan 16, 2007 12:32 AM|LINK
It looks like remote server is not available.
Can you access that URL form IE?
Jan 16, 2007 08:41 AM|LINK
Yah, I can. When doing a post with HttpRequest I had to specify ther UserAgent otherwise it didn't work. I guess the server required that header for the request to be successful.
But thanks for your post anyhow!
Good day to you!
Jan 17, 2007 12:55 AM|LINK
I would retrieve xml data in code behind using HttpWebRequest in which you could use UserAgent.
Here is a sample:
// Create a new 'HttpWebRequest' object to the mentioned URL.
myHttpWebRequest.UserAgent=".NET Framework Test Client";
// Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable.
// Display the contents of the page to the console.
StreamReader streamRead = new StreamReader( streamResponse );
Char readBuff = new Char;
int count = streamRead.Read( readBuff, 0, 256 );
Console.WriteLine("\nThe contents of HTML Page are :\n");
while (count > 0)
String outputData = new String(readBuff, 0, count);
count = streamRead.Read(readBuff, 0, 256);
// Release the response object resources.
For details see