user98744
user98744

Reputation: 13

web service

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

Answers (2)

Michael Kniskern
Michael Kniskern

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

C. Ross
C. Ross

Reputation: 31848

You need to add your windows id on your desktop to the allowed users in IIS.

Upvotes: 0

Related Questions