This project is read-only.

integrated windows authentication

Topics: Developer Forum
Jan 28, 2007 at 12:07 AM
I'm getting the error "The remote server returned an error: (401) Unauthorized." when calling the second line below. The web service is defined in IIS with windows authentication and my client app a winform. How do I tell the proxy factory to use the credentials of the current user when interogating the Uri?

Uri uri = new Uri("http://localhost/MyProject/Service.asmx?WSDL");
ProxyFactory<IClass1> _proxyFactory = new ProxyFactory<IClass1>(uri);
Feb 3, 2007 at 12:11 AM
anyone supporting this product...?
Feb 18, 2007 at 11:00 PM
Thank you for submitting this issue. I'm going to convert your post to work item.
A specific property (Credentials) will be probably added to the ProxyFactory class.
Feb 18, 2007 at 11:01 PM
This discussion has been copied to Work Item 8341. You may wish to continue further discussion there.
Feb 28, 2007 at 2:33 PM
A new release is available. The integrated windows authentication is henceforth supported.

ProxyFactory<IService> __serviceFactory = new ProxyFactory<IService>("MyService");
ICredentials __credentials = new NetworkCredential("username", "password", "domain");
__serviceFactory.SetPropertyValue(WebServicesPropertyMetadata.CredentialsProperty, __credentials);
IService __service = __serviceFactory.CreateProxy();
string __text = __service.HelloWorld();

<?xml version="1.0" encoding="utf-8" ?>
<endpoint name="MyService"
contract="MyContracts.IService, MyContracts"
address="http://localhost/MyProject/Service.asmx?WSDL" />

Any feedback is welcome.