tags:

views:

70

answers:

2
+1  Q: 

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.

A: 

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

C. Ross
I can pass credential to pop up window, which appear on browser before accessing web service, and it work fine.Now, i created a test console application, where i added web reference. and discover web service. But when i try to use web method within test application, it shows 401 error in cosole.
+2  A: 

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");
Michael Kniskern
I have domainName\username and passwored.how can i pass these credential programatically?
Are you referencing the web service on your local workstation or a remote server?
Michael Kniskern
remote server.i know user name and password.
thank you Michael.
You can used the first solution if you are trying to debug a web service on your local workstation
Michael Kniskern