XmlUrlResolver not working right

D

David Thielen

I have a test http url that allows a connection from any domain user.

I am using the following code to test access to it:
XmlReaderSettings readerSettings = new XmlReaderSettings();
readerSettings.ProhibitDtd = false;
readerSettings.ValidationType = ValidationType.DTD;
XmlUrlResolver resolver = new XmlUrlResolver();
resolver.Credentials = new NetworkCredential("dave", "bogus");
readerSettings.XmlResolver = resolver;
XmlReader xmlReader = XmlReader.Create(filename, readerSettings);
while (xmlReader.Read())
// nothing - just make sure can read all
;

But the above is a bad password. Shouldn't this fail? I am testing this case
because we can use forms login and in that case the user must enter their
username/password - we don't want to allow the credentials of the ASP.NET app
to allow access.

Am I missing something?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
S

Steven Cheng[MSFT]

Hello Dave,

I think the problem you meet is is due to the server-side web
application/page is using Forms Authentication, the httpwebrequest based
programmatic http web requesting does not support interactive with forms
authentication. Forms Authentication always require an interactive client
user. There does exists means to programmatically request pages secured
through forms authentication, you can construct a http post message with
the username/password forms data pair and send it to the login page, after
that hold the returned cookie collection so that you can use httpwebrequest
to access other pages secured by the forms authentication later. here is a
good web article demonstrate on this:

http://odetocode.com/Articles/162.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top