The HTTP client downloads the XML through the right proxy. The next line creates an XML reader from the original URL. That line starts another retrieval instead of parsing the downloaded data.

For a client already configured with the intended route, hand its response stream to the parser:

using var response = await client.GetAsync(documentUri);
response.EnsureSuccessStatusCode();
using var stream = await response.Content.ReadAsStreamAsync();

var settings = new XmlReaderSettings
{
    DtdProcessing = DtdProcessing.Prohibit,
    XmlResolver = null
};
using var reader = XmlReader.Create(stream, settings, documentUri.AbsoluteUri);
var document = XDocument.Load(reader);

The relevant namespaces are System.Xml and System.Xml.Linq. The example disables DTD processing and external resolution deliberately; it is not a way to fetch arbitrary external entities through the same client.

The base URI preserves the document's location metadata. If an approved parsing or validation workflow does retrieve external schemas or other dependencies, those fetches need their own explicit resolver and routing design.

Do not diagnose a second network failure by changing the password on the first, successful client. Establish whether the parser received a stream or a URL, then follow any additional resources separately.

Tënë sô zo