Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > How to sets credentials used to authenticate Web requests

Reply
Thread Tools

How to sets credentials used to authenticate Web requests

 
 
Li Pang
Guest
Posts: n/a
 
      09-13-2005
Hi,

I put a xml file in a web site "http://localhost/XML/default.xml", and I try
to open it from the following codes:

Dim doc As XmlDocument
doc = New XmlDocument()
doc.Load("http://localhost/XML/default.xml")

then I got an error: "(401) Unauthorized"

When I enabled anonymous access in "http://localhost/XML" site, then the
file can be opened successfully.

I'd like to know how to set credentials programmatically for this site and
keeping anonymous access disabled.

Thanks in advance



 
Reply With Quote
 
 
 
 
Dominick Baier [DevelopMentor]
Guest
Posts: n/a
 
      09-13-2005
Hello Li,

seems that XmlDocument does not support that. I would recommend opening the
file manually using HttpWebRequest or WebClient (both support a Credentials
property) and passing the stream to the ctor of XmlDocument.

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

> Hi,
>
> I put a xml file in a web site "http://localhost/XML/default.xml", and
> I try to open it from the following codes:
>
> Dim doc As XmlDocument
> doc = New XmlDocument()
> doc.Load("http://localhost/XML/default.xml")
> then I got an error: "(401) Unauthorized"
>
> When I enabled anonymous access in "http://localhost/XML" site, then
> the file can be opened successfully.
>
> I'd like to know how to set credentials programmatically for this site
> and keeping anonymous access disabled.
>
> Thanks in advance
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Does timer in Web Service Global.asax block my Web Service from processing web-site requests? Leo Violette ASP .Net Web Services 0 04-17-2009 12:39 AM
Erros -> User credentials cannot be used for local connections LamSoft ASP .Net 1 07-24-2007 12:14 PM
"The credentials supplied conflict with an existing set of credentials" -=rjh=- NZ Computing 2 07-15-2006 11:09 PM
web requests and mobile requests Fernando Arámburu ASP .Net 1 04-08-2005 07:13 PM



Advertisments