Authentication problem

Discussion in 'ASP .Net Web Services' started by Nikolay Petrov, Oct 18, 2004.

  1. 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
     
    Nikolay Petrov, Oct 18, 2004
    #1
    1. Advertising

  2. In Windows forms app

    "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
    news:...
    > 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 ...?
    >
    > --
    > Scott
    > http://www.OdeToCode.com/
    >
    > On Mon, 18 Oct 2004 22:31:32 +0300, "Nikolay Petrov"
    > <> wrote:
    >
    >>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
    >>

    >
     
    Nikolay Petrov, Oct 18, 2004
    #2
    1. Advertising

  3. Nikolay Petrov

    Scott Allen Guest

    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 ...?

    --
    Scott
    http://www.OdeToCode.com/

    On Mon, 18 Oct 2004 22:31:32 +0300, "Nikolay Petrov"
    <> wrote:

    >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
    >
     
    Scott Allen, Oct 18, 2004
    #3
  4. Nikolay Petrov

    Scott Allen Guest

    Opps, ignore that link, it's out of date, apologies.

    See:
    Troubleshooting Security Issues
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch13.asp

    and

    Item 10: How to enable auditing
    http://www.pluralsight.com/keith/book/html/howto_enableauditing.html

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Mon, 18 Oct 2004 22:31:32 +0300, "Nikolay Petrov"
    <> wrote:

    >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
    >
     
    Scott Allen, Oct 18, 2004
    #4
  5. I have turned on auditing before some time and I have allready checked the
    event log. It's clear.


    "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
    news:...
    > 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 ...?
    >
    > --
    > Scott
    > http://www.OdeToCode.com/
    >
    > On Mon, 18 Oct 2004 22:31:32 +0300, "Nikolay Petrov"
    > <> wrote:
    >
    >>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
    >>

    >
     
    Nikolay Petrov, Oct 18, 2004
    #5
  6. Any firewalls in between? Does the client PC have any firewall installed?
    Try disabling it if you do.

    --
    - Paul Glavich
    Microsoft MVP - ASP.NET


    "Nikolay Petrov" <> wrote in message
    news:%...
    > 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.ToStrin
    g
    > 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
    >
    >
     
    Paul Glavich [MVP - ASP.NET], Oct 19, 2004
    #6
  7. 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.



    "Paul Glavich [MVP - ASP.NET]" <-NOSPAM> wrote in
    message news:%...
    > Any firewalls in between? Does the client PC have any firewall installed?
    > Try disabling it if you do.
    >
    > --
    > - Paul Glavich
    > Microsoft MVP - ASP.NET
    >
    >
    > "Nikolay Petrov" <> wrote in message
    > news:%...
    >> 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.ToStrin
    > g
    >> 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
    >>
    >>

    >
    >
     
    Nikolay Petrov, Oct 19, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Connell
    Replies:
    1
    Views:
    553
    Natty Gur
    Oct 21, 2003
  2. raj mandadi
    Replies:
    0
    Views:
    437
    raj mandadi
    Dec 22, 2003
  3. Brett Porter
    Replies:
    2
    Views:
    781
    Andrea D'Onofrio [MSFT]
    Jan 20, 2004
  4. Mark
    Replies:
    0
    Views:
    681
  5. Brett Porter
    Replies:
    5
    Views:
    592
    Brett Porter
    Feb 3, 2004
Loading...

Share This Page