Hi All,
I am trying to consume a web service that requires a username/password.
If I go direct to the web service in my browser, I get a password box.
If I enter the username/password I am presented with the usual 'The
following operations are supported.' - All fine! :)
Now, when I try to use the service in my application, I get the
following error:
"The request failed with HTTP status 401: Access Denied."
My code to use the web service is this:
Dim BS7666 As New bs7666.BS7666
Dim CredCache As New CredentialCache
CredCache.Add(New Uri(BS7666.Url), "Negotiate", New
NetworkCredential("UserName", "PassWord", "ServerName"))
BS7666.Credentials = CredCache
Dim DataSet_bs7666 As New DataSet
DataSet_bs7666 = BS7666.GetAddresses(0, "", strPostCode.ToLower,
BuildingNoOrName.ToLower, "", strStreet.ToLower, 0, 0) <-- This is
where it fails.
I don't get it! Help! :)
Thanks,
Simon.I've just checked my IIS logs, seems no user name/password are being
passed when my application accesses the service. Odd.
Any help will be much appreciated! :)
Ok, changed it to this:
CredCache.Add(New Uri(BS7666.Url), "Negotiate", New
NetworkCredential("UserName", "Basic", "ServerName"))
(Note auth type changed from Negotiate to Basic)
It now passes the correct user name and password, but, throws this
error:
"Invalid URI: The format of the URI could not be determined."
I know that BS7666.Url.toString returns the correct URL to my web
service.
Any ideas anyone?
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment