xmlDocument.Load - (401) Unauthorized

R

Roman

I am trying to load an XML file using 'Load' method on a
XmlDocument object.

xmlDocument.Load("http://localhost/Test.xml");

In return I am getting an exeption; "The remote server
returned an error: (401) Unauthorized.".
 
J

Jon Skeet [C# MVP]

Roman said:
I am trying to load an XML file using 'Load' method on a
XmlDocument object.

xmlDocument.Load("http://localhost/Test.xml");

In return I am getting an exeption; "The remote server
returned an error: (401) Unauthorized.".

And what's serving up the XML? Does it expect authorization of some
kind? Check whether it's actually getting the request, or whether it's
being proxied somehow.
 
G

Guest

All I can see in the log file is: 18:15:49 127.0.0.1
GET /Parsers/Ess/1.0.0.0/Map.xml 401
 
J

Jon Skeet [C# MVP]

All I can see in the log file is: 18:15:49 127.0.0.1
GET /Parsers/Ess/1.0.0.0/Map.xml 401

Right. So it's getting to the right machine - you now need to look at
your configuration to find out why the request is being rejected.
 
R

Roman

I have a default configuration, anonymous access with
integrated windows authentication.
 
J

Jon Skeet [C# MVP]

Roman said:
I have a default configuration, anonymous access with
integrated windows authentication.

I suspect that XmlDocument.Load doesn't use Windows authentication. At
least, it's certainly worth trying the whole shebang without any
authentication at the server side, and see if that works.
 
J

Jon Skeet [C# MVP]

Roman said:
Yes. From the browser it works fine

Well, use a network analyser and find out what difference there is
between what .NET does and what the browser does.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top