473,473 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

HttpWebRequest Problem

12 New Member
I have this code(in a separate thread if it helps):
Expand|Select|Wrap|Line Numbers
  1.             // I know i don't store data from here. There is a reason for it.
  2.             HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(mainUrl);
  3.             req.CookieContainer = this.cookieJar;
  4.             req.Method = "GET";
  5.             req.GetResponse();
  6.  
  7.             // Another request
  8.             HttpWebRequest gReq = (HttpWebRequest)HttpWebRequest.Create(secondaryUrl);
  9.             gReq.CookieContainer = this.cookieJar;
  10.             gReq.Method = "GET";
  11.             gReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 7.1)";
  12.             WebResponse res = (HttpWebResponse)gReq.GetResponse();
  13.             StreamReader sr = new StreamReader(res.GetResponseStream());
  14.             string response = sr.ReadToEnd();
  15.             sr.Close();
  16.             XmlDocument gPage = new XmlDocument();
  17.             gPage.LoadXml(response);
Now, at the last line (gPage.LoadXml(response)) it crashes with the next exception:
Expand|Select|Wrap|Line Numbers
  1. The remote server returned an error: (503) Server Unavailable
I guess it's actully not in that line, but the problem is, that everything is available, I do have the needed response in the 'response' string..

Please help me out.
Thanks.
Mar 1 '10 #1
2 4708
sashi
1,754 Recognized Expert Top Contributor
Kindly refer to below attached link, hope it helps :)

C# httpwebrequest server unavailable 503 problem
Mar 1 '10 #2
mcco
12 New Member
Thanks for the help, but I found my problem.
I am trying to load HTML document into XmlDocument and that is what causes the exception to be thrown.
Mar 1 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Dan Battagin | last post by:
Is there a known bug with the interaction between the HttpWebRequest and the ThreadPool? I current spawn several HttpWebRequest's using BeginGetResponse, and they work for a while, using worker...
10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
16
by: thomas peter | last post by:
I am building a precache engine... one that request over 100 pages on an remote server to cache them remotely... can i use the HttpWebRequest and WebResponse classes for this? or must i use the...
0
by: Cozfer | last post by:
I am having a problem communicating with a remote server (on intranet) using the httpwebrequest object. We have used the object to communicate with other machines previously, but this time we must...
7
by: gorkos | last post by:
Hi, I am two days trying to solve a problem with some pages, which i get through HTTPWebRequest. Error is that some pages need Script to be enabled. But how to do this in HTTPWebRequest class?
16
by: Cheung, Jeffrey Jing-Yen | last post by:
I have a windows form application that generates a request, downloads an image, and waits the user to enter in login info. Unfortunately, this image is dynamic and based on session data. I have...
0
by: boxboy | last post by:
Hi, I'm writing a console application and am having a problem with HttpWebRequest when posting data to a webserver. A "System.Net.WebException: The server committed a protocol violation" is always...
3
by: JansenH | last post by:
We have implemented a 'HTTP Post' client in C# that posts Xml documents to a webserver. This is working fine if the post rate is one post for every 20 seconds. But if the post rate is increased to...
2
by: =?Utf-8?B?TGFycnlLdXBlcm1hbg==?= | last post by:
Our WebDev team seems to have found a problem that exposes a bug in .NET 2.0. This problem can be shown when trying to access a WebService using SSL and through a proxy server after using the...
1
by: Proogeren | last post by:
I have a problem with a httpwebrequest that I am creating. The request in itself looks correct but using fiddler I see that a www-authentication header is sent along as well. The code is pasted...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.