When must set Credentials with webservice?

A

ad

When we new a web Service, the default in IIS is Allow Anonymous and
Integrated Windows Authentication , we just use :
WebService.webClass myWC= new WebService.webClass();
and then we can access the WebService thought myWC

But I find some time it will fail with Access denid, and I must
must use:
WebService.webClass myWC= new WebService.webClass();
myWC.PreAuthenticate = true;
myWC.Credentials = System.Net.CredentialCache.DefaultCredentials;

I can't find when we must set Credentials, when we need not.

Could some one tell me?
 
M

Matt Dunn

Greetings,

There are (at least) two circumstances when you must provide default
credentials when issuing web service requests:

- When the website/virtual directory hosting the web services only
allows Windows Authentication; and

- If the web service requests pass through an authenticating proxy
server.

You should be able to tell from the access denied error message whether
a proxy is generating the error in your environment.

Cheers,
Matt
 

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,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top