Consuming Web Service via Windows Authentication

Posted by saravanaram on Stack Overflow See other posts from Stack Overflow or by saravanaram
Published on 2009-08-12T06:02:51Z Indexed on 2010/04/20 15:03 UTC
Read the original article Hit count: 210

Filed under:

I am just trying to consuming a web service in remote computer using windows authentication however login credentials are different in local & remote computer.

Code Snippet:

Dim objproxy As New WebReference.Service1
'Create a new instance of CredentialCache.
Dim mycredentialCache As CredentialCache = New CredentialCache()
'Create a new instance of NetworkCredential using the client
Dim credentials As NetworkCredential = New NetworkCredential("username", "pwd","domain")
'Add the NetworkCredential to the CredentialCache.
'mycredentialCache.Add(New Uri(objproxy.Url), "Basic", credentials)
objproxy.Credentials = credentials

It is timing out but when i use

mycredentialCache.Add(New Uri(objproxy.Url), "Basic", credentials)

I get "401 Unauthorized" message,

Please assist.

© Stack Overflow or respective owner

Related posts about web-services