Set Authentication Credentials for a Web Service
Problem
You want a Web service client to submit logon credentials for IIS authentication.
Solution
Use the Credentials property of the proxy class. You can create a new NetworkCredential object or use the CredentialCache to retrieve the credentials for the current user.
Discussion
Web services, like Web pages, can be used in conjunction with IIS authentication. All you need to do is place your Web services in a virtual directory that restricts anonymous access.
Unlike Web pages, Web services have no built-in method for retrieving authentication information from the client because Web services are executed by other applications, not directly by the user. Thus, the application that’s interacting with the ...
Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.