Reputation: 2353
I have a web service set up on an IIS server. When I navigate to the page in a web browser it asks me for my user name an password, as desired. However I want to consume the service in a .NET application (C#). What do I need to do to provide a user name and password programmatically so that I can consume the service? Or is there some other way I should be authenticating a user?
Upvotes: 2
Views: 608
Reputation: 57936
Try something like this:
YourWebReference webservice = new YourWebReference();
webservice.Credentials = new System.Net.NetworkCredential("username","password");
webservice.DoSomething();
Upvotes: 2