I have this code(in a separate thread if it helps):

// I know i don't store data from here. There is a reason for it.
            HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(mainUrl);
            req.CookieContainer = this.cookieJar;
            req.Method = "GET";
            req.GetResponse();

            // Another request
            HttpWebRequest gReq = (HttpWebRequest)HttpWebRequest.Create(secondaryUrl);
            gReq.CookieContainer = this.cookieJar;
            gReq.Method = "GET";
            gReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 7.1)";
            WebResponse res = (HttpWebResponse)gReq.GetResponse();
            StreamReader sr = new StreamReader(res.GetResponseStream());
            string response = sr.ReadToEnd();
            sr.Close();
            XmlDocument gPage = new XmlDocument();
            gPage.LoadXml(response);

Now, at the last line (gPage.LoadXml(response)) it crashes with the next exception:

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.

I found my problem - I am trying to load HTML document into XmlDocument and that is what causes the exception to be thrown.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.