![]() |
|
|
|
#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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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.Identit y.Name >> tmpArr(1) = >>System.Threading.Thread.CurrentPrincipal.Identit y.AuthenticationType.ToString >> tmpArr(2) = >>System.Threading.Thread.CurrentPrincipal.Identit y.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 >> > |
|
|
|
#3 |
|
Posts: n/a
|
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 > |
|
|
|
#4 |
|
Posts: n/a
|
Opps, ignore that link, it's out of date, apologies.
See: Troubleshooting Security Issues http://msdn.microsoft.com/library/de...SecNetch13.asp and Item 10: How to enable auditing http://www.pluralsight.com/keith/boo...eauditing.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 > |
|
|
|
#5 |
|
Posts: n/a
|
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.Identit y.Name >> tmpArr(1) = >>System.Threading.Thread.CurrentPrincipal.Identit y.AuthenticationType.ToString >> tmpArr(2) = >>System.Threading.Thread.CurrentPrincipal.Identit y.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 >> > |
|
|
|
#6 |
|
Posts: n/a
|
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 > > |
|
|
|
#7 |
|
Posts: n/a
|
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 >> >> > > |
|