401 error accessing web service using credentials

Discussion in 'ASP .Net Web Services' started by Brad, Dec 19, 2006.

  1. Brad

    Brad Guest

    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
     
    Brad, Dec 19, 2006
    #1
    1. Advertising

  2. 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.
     
    Steven Cheng[MSFT], Dec 19, 2006
    #2
    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. Claudia Fong
    Replies:
    8
    Views:
    694
    Jacques
    Dec 7, 2007
  2. Ben
    Replies:
    10
    Views:
    2,360
  3. DLS

    401.1 Error Invalid credentials

    DLS, Jun 4, 2005, in forum: ASP .Net Security
    Replies:
    1
    Views:
    149
  4. Stephen

    401 Error on Windows 2003 Server Accessing Web Service

    Stephen, Nov 10, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    184
    Stephen
    Nov 10, 2004
  5. danA

    HTTP error 401.1 when accessing a web service

    danA, Aug 20, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    171
Loading...

Share This Page