Web Service Credentials

  • Thread starter Web Team @ Borough of Poole
  • Start date

Web Team @ Borough of Poole

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! :)


Web Team @ Borough of Poole

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! :)

Web Team @ Borough of Poole

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

"Invalid URI: The format of the URI could not be determined."

I know that BS7666.Url.toString returns the correct URL to my web

Any ideas anyone?

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