When must set Credentials with webservice?

  • Thread starter Thread starter ad
  • Start date Start date
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?
 
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
 
Back
Top