Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / December 2006

Tip: Looking for answers? Try searching our database.

401 error accessing web service using credentials

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brad - 19 Dec 2006 03:34 GMT
I'm setting up my new pc with all my VS.net projects and I'm missing
something.....something I've done many times before without problem.    I
have several asp.net apps accessing secure .net web services (secure meaning
windows authentication credentials must be used to access the web services).
The problem is that when the web apps attempt to access a web service they
are receiving  401: unathorized.

- The apps are all running on web sites on my pc.
- I have created the local user accounts
- Set up the web services to require windows authentication (both in the
web.cofnig and in the iis settings..anonymous is turn off) and to allow only
me and the user for app authentication.
- Required user is included in the folder level access permissions.
- I have accessed several of the service asmx files via web browser and I
authenticate successfully (I even removed my access in the web.config to
confirm that authentication would fail without)

In the web app that accesses the service I am using credential caching and
pre authenticating
   Dim cache As New CredentialCache
   Dim user As String = "myuser"
   Dim password As String = "mypassword"
   cache.Add(New Uri(ws.Url), "Negotiate", New NetworkCredential(user,
password, domain))
   ws.Credentials = cache
   ws.PreAuthenticate = True

In the web service configs
   <authentication mode="Windows"/>
   <authorization>
       <allow users="mypc\wsuser, companydomain\myuser"/>
   <deny users="*"></deny>
</authorization>

When I look at the security event logs I can see a Success event for NETWORK
SERVICE using the credentials, followed immediately by a Failure event for
SYSTEM using the same user name  "Reason:  An error occurred during logon".
On my old pc it works and the security event logs correctly shows the
supplied user name logging on instead of the SYSTEM user failure.  I have
event changed the web apps to use my personal login information and the same
problem occurs.

Since these same apps work on my old pc and for others here.  What the heck
am I missing?

Brad
Steven Cheng[MSFT] - 19 Dec 2006 08:20 GMT
Hello Brad,

I've found your another thread in the following newsgroup and have posted
some suggestion there:

Newsgroups: microsoft.public.dotnet.framework.webservices
Subject: RE: 401 error accessing web service using credentials

Please feel free to followup there if you have any further question or if
you have new finding.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.