Authentication problem

  • Thread starter Thread starter Nikolay Petrov
  • Start date Start date
N

Nikolay Petrov

I have the following web method:

<WebMethod()> _
Public Function Test_CurrentCredentials() As String()
Dim tmpArr(2) As String
tmpArr(0) = "User: " &
System.Threading.Thread.CurrentPrincipal.Identity.Name
tmpArr(1) =
System.Threading.Thread.CurrentPrincipal.Identity.AuthenticationType.ToString
tmpArr(2) =
System.Threading.Thread.CurrentPrincipal.Identity.IsAuthenticated.ToString
Return tmpArr
End Function

In my app I call it this way:
Dim tmpArr() as string
Dim svc As New WebReference.Service1
svc.Credentials = System.Net.CredentialCache.DefaultCredentials
tmpArr = svc.Test_CurrentCredentials

When I run the app I get the following error:
The request failed with HTTP status 401: Access Denied


I have Disabled Anonymous authentication for my Web Service folder. Only
Integrated Windiows Authentication is active.

What is the problem?

Tia
 
In Windows forms app

Scott Allen said:
One way to troubleshoot is to turn on login auditing to see what
credentials are being presented by the code to the server. Perhaps
they are the credentials of a local account that the web server
cannot authenticate.

Too see steps to enable login auditing, see:
http://support.microsoft.com/kb/q185874/

Where does this line of code exist:

"svc.Credentials = System.Net.CredentialCache.DefaultCredentials"

Is it in a console application or ASP.NET application or ...?
 
One way to troubleshoot is to turn on login auditing to see what
credentials are being presented by the code to the server. Perhaps
they are the credentials of a local account that the web server
cannot authenticate.

Too see steps to enable login auditing, see:
http://support.microsoft.com/kb/q185874/

Where does this line of code exist:

"svc.Credentials = System.Net.CredentialCache.DefaultCredentials"

Is it in a console application or ASP.NET application or ...?
 
I have turned on auditing before some time and I have allready checked the
event log. It's clear.
 
Any firewalls in between? Does the client PC have any firewall installed?
Try disabling it if you do.
 
Everything is on my PC.
However I have found the cause for the problem.
I have disable HTTP keep alive, which is required for NTLM authntication to
run.
 
Back
Top