Consume a WebService with Integrated authentication from WPF windows application

Posted by Tr1stan on Stack Overflow See other posts from Stack Overflow or by Tr1stan
Published on 2010-03-19T09:56:47Z Indexed on 2010/03/19 10:01 UTC
Read the original article Hit count: 525

I have written a WPF windows application that consumes a .net WebService. This works fine when the web service in hosted to allow anonymous connections, however the WebService I need to consume when we go live will be held within a website that has Integrated Authentication enabled.

The person running the WPF application will be logged onto a computer within the same domain as the web server and will have permission to see the WebService (without entering any auth info) if browsing to it using a web browser that is NTLM auth enabled.

Is it possible to pass through the details of the already logged in user running the application to the WebService?

Here is the code I'm currently using:

MyWebService.SearchSoapClient client = new SearchSoapClient();
//From the research I've done I think I need to something with these:
//UserName.PreAuthenticate = true;
//System.Net.CredentialCache.DefaultCredentials;
List<Person> result = client.FuzzySearch("This is my search string").ToList();

Any pointers much appreciated.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about .NET