Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6981375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:08:59+00:00 2026-05-27T18:08:59+00:00

XDocument xDoc = new XDocument(); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri); req.Timeout = 1000 * 60

  • 0
    XDocument xDoc = new XDocument();
    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
    req.Timeout = 1000 * 60 * 5;
    WebResponse res = req.GetResponse();
    Stream responseStream = res.GetResponseStream();
    xDoc = XDocument.Load(responseStream);
    responseStream.Close();

I am trying to use the above code to load a uri into an xdocument. I am using the HttpWebRequest and WebResponse to avoid the timeout error.

Now the problem is that most of the times the code does work but at the point where I was getting a “timeout” error before, now I am facing an “Internal server error (500)” when trying to use the above code. Any clues as to how to solve this issue? Code examples would be of great help.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:08:59+00:00Added an answer on May 27, 2026 at 6:08 pm

    I might be mistaken, but the Http 500 Interal server error is being generated by the server hosting the uri that you call. Your code might be correct, but the server is returning an error. You need to debug the server script (if you control it) or alternatively handle the http 500 error in your code.

    You should call the uri directly from a browser to see if that triggers the http 500 internal server error. If so (and you control the web server) you could check the server log for more details.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got this code: XDocument xdoc = XDocument.Load(URI); XElement root = xdoc.Element(forecast); //get
I have the following: XDocument xdoc = XDocument.Load(C:\\myfile.xml); List<Tag> list = new List<Tag>(); foreach
This works fine: XDocument xdoc = new XDocument( new XDeclaration(1.1, UTF-8, yes), new XProcessingInstruction(foo,
I have a Xdocument that is populated as follows: XDocument xDoc = XDocument.Parse(new StreamReader(response.GetResponseStream()).ReadToEnd());
I've referenced System.Xml: using System.Xml; Then in this line: XmlDocument xdoc = new XmlDocument();
We currently have code like this: Dim xDoc = XDocument.Load(myXMLFilePath) The only way we
I have a XDocument that looks like this: XDocument outputDocument = new XDocument( new
I have this code: XDocument xdoc = XDocument.Parse(xml); XElement xe = xdoc.Root.Element(program); string[] data
I have the following code in one of our projects webpages: XmlDocument xDoc =
I have an XDocument and have to remove a node and add the very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.