-1

I use Xml reader to read some blogs feed like this:

var reader = XmlReader.Create(url);

I'm getting an error with some urls:

{"The remote server returned an error: (403) Forbidden."}

If I open this url in my browser it works well.

Do you have any idea what's wrong?

mskuratowski
  • 4,014
  • 15
  • 58
  • 109

1 Answers1

1

You can supply credentials for the XmlReader to use when accessing a URL; which is likely what you need to do in your circumstance. see https://msdn.microsoft.com/en-us/library/47as68k4(v=vs.71).aspx for details.

You could also use an HttpClient object with credentials to get the response as a Stream and use XmlReader.Create(Stream) instead.

Peter Ritchie
  • 35,463
  • 9
  • 80
  • 98