Reputation: 13
I have web service, which use integrated security in IIS. Now, I want to test my web service. I created a console application and adding web reference. now, when i m trying to use web method. It show 401 error. m i missing any authentication. I think i need to pass user name and password programatically. can anyone direct me in right direction.
Upvotes: 1
Views: 410
Reputation: 25260
Set the web service credentials to the System.Net.CredentialCache.DefaultCredentials in your console app
MyWebService proxy = new MyWebService();
proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
Edit
pass credentials programmatically:
MyWebService proxy = new MyWebService();
proxy.Credentials = new System.Net.NetworkCredential("username", "password", "domainname");
Upvotes: 2
Reputation: 31848
You need to add your windows id on your desktop to the allowed users in IIS.
Upvotes: 0