Sunday, November 28, 2004

Sending credentials to WebService

Sometimes you need to send your windows credentials to the webservice. A simple way can be to use Network credentials provided by Microsoft.net framework.

The credentials are made on the webservice proxy.

MyWebService.Service1 proxy = new MyWebService.Service1();
proxy.Credentials = new NetworkCredential("Administrator","adminPassword");

Now if you have windows integrated security turned on ( It can be turned on from IIS ) it will only allow those users who have the windows login credentials and other users will get the 401 Access denied error.

No comments: