Auth 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

The app is Windows Forms app.

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.
In my Web Service web.config file I have thi line:
<authentication mode="Windows" />
When Anonymous is Enabled I can connect to service.

I have auditing turned on and doesn't show nothing.
What is the problem?

Tia
 
Is the app on the calling computer running as a domain user account? If not,
you might want to replace

svc.Credentials = System.Net.CredentialCache.DefaultCredentials

with:

Dim credentials=New NetworkCredential("domainuser", "password", "MYDOMAIN")
svc.Credentials=credentials
 

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

Back
Top