CredentialCache.DefaultCredentials Not working

R

Ramdas

I am using the following method to call a web service from a windows application

Dim a As New MachineReference.Service1
a.Credentials = s 'System.Net.CredentialCache.DefaultCredentials
Dim strret As String = a.HelloWorld()
a.Dispose()
a = Nothing
MsgBox(strret)

My web site has only Integrated security set.
This web service works when I try using the browser. But doesnt work when i try the windows application logged into the pc as sthe same user.

It gives the following error

An unhandled exception of type 'System.Net.WebException' occurred in system.web.services.dll
Additional information: The request failed with HTTP status 401: Access Denied.

The same code works on Other PCs in the network
Also the same code works when I set credentials using the following code

Dim cache As System.Net.CredentialCache = New System.Net.CredentialCache
cache.Add(New Uri(a.Url), "Negotiate", New System.Net.NetworkCredential("user", "password", ""domain))
a.Credentials = cache

We want to use defaultcredentials. Any suggessions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top