Recently I wanna practice some web service program. I stucked at one error The request failed with HTTP status 401:Unauthorized. .
I had set up the credential in my code like following, so my program should have right to excute
Dim objWS As New SoapHeaderTestWS.Service1
Dim objWSHeader As New SoapHeaderTestWS.HeaderClass
Dim credCache As New CredentialCache
credCache.Add(New Uri(objWS.Url), "Basic", _
New NetworkCredential("Administrator", "pass@word1"))
objWS.Credentials = credCache
however i still have "HTTP status 401:Unauthorized. ." error.
I found my problem is in IIS setting. I had to check "Basic authentication(password is sent in clear text)".
I guess the reason is simple, because I use "Basic" authentication type in my code.
So I have to configue my webserivice in IIS to correspond with my code.
![](https://img2024.cnblogs.com/blog/35695/202403/35695-20240328092537879-1189167464.jpg)