title: How to configure the XML parser to disable external entity resolution in c#
body: <pre><code>var xDoc = XDocument.Load(fileName);
  </code></pre>
  
  <p>I am using above code in a function to load an XML file. Functionality wise its working fine but it is showing following Veracode Flaw after Veracode check. </p>
  
  <p><strong>Description</strong></p>
  
  <p>The product processes an XML document that can contain XML entities with URLs that resolve to documents outside
  of the intended sphere of control, causing the product to embed incorrect documents into its output. By default, the
  XML entity resolver will attempt to resolve and retrieve external references. If attacker-controlled XML can be
  submitted to one of these functions, then the attacker could gain access to information about an internal network, local
  filesystem, or other sensitive data. This is known as an XML eXternal Entity (XXE) attack.</p>
  
  <p><strong>Recommendations</strong></p>
  
  <p>Configure the XML parser to disable external entity resolution.</p>
  
  <p><em>What I need to do to resolve it.</em> </p>