Windows Authentication and WebServices

Discussion in 'ASP .Net Web Services' started by Kevin Harrison, Sep 25, 2003.

  1. I have an IIS6 site set to Windows Authentication only.

    It contains a WebService that the site tries to access, however the SOAP
    request always returns a 401 error:

    The request failed with HTTP status 401: Unauthorized.
    at
    System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClient
    Message message, WebResponse response, Stream responseStream, Boolean
    asyncCall) at

    I've also tried consume it from an application with the same results.

    The current Windows Identity (for the consuming site / application) is a
    comain account with permission to access the WebService. I.e. the following
    returns details of an NTLM domain account with permissions to access the web
    service:

    System.Security.Principal.WindowsIdentity.GetCurrent()
    I've tried setting the identity for the current thread in the consumer, but
    this doesn't make any difference (am I barking up the wrong tree?), i.e.:

    System.Threading.Thread.CurrentPrincipal = new
    System.Security.Principal.WindowsPrincipal(System.Security.Principal.Windows
    Identity.GetCurrent())

    How can I consume my Web Service?

    BTW: The URL for the web service is in the Local Intranet zone on IE for all
    clients.
    Kevin Harrison, Sep 25, 2003
    #1
    1. Advertising

  2. Kevin Harrison

    Jan Tielens Guest

    Kevin

    Try this:
    'Create webservice instance...
    webservice.Credentials = System.Net.CredentialCache.DefaultCredentials
    webservice.PreAuthenticate = True
    'Do webservice call.

    Jan

    "Kevin Harrison" <> schreef in bericht
    news:...
    > I have an IIS6 site set to Windows Authentication only.
    >
    > It contains a WebService that the site tries to access, however the SOAP
    > request always returns a 401 error:
    >
    > The request failed with HTTP status 401: Unauthorized.
    > at
    >

    System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClient
    > Message message, WebResponse response, Stream responseStream, Boolean
    > asyncCall) at
    >
    > I've also tried consume it from an application with the same results.
    >
    > The current Windows Identity (for the consuming site / application) is a
    > comain account with permission to access the WebService. I.e. the

    following
    > returns details of an NTLM domain account with permissions to access the

    web
    > service:
    >
    > System.Security.Principal.WindowsIdentity.GetCurrent()
    > I've tried setting the identity for the current thread in the consumer,

    but
    > this doesn't make any difference (am I barking up the wrong tree?), i.e.:
    >
    > System.Threading.Thread.CurrentPrincipal = new
    >

    System.Security.Principal.WindowsPrincipal(System.Security.Principal.Windows
    > Identity.GetCurrent())
    >
    > How can I consume my Web Service?
    >
    > BTW: The URL for the web service is in the Local Intranet zone on IE for

    all
    > clients.
    >
    >
    Jan Tielens, Sep 25, 2003
    #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. Abdullah

    form authentication and webservices

    Abdullah, Feb 9, 2007, in forum: ASP .Net Security
    Replies:
    7
    Views:
    167
    Joe Kaplan
    Feb 12, 2007
  2. Asim Qazi

    Webservices Authentication

    Asim Qazi, Apr 19, 2004, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    109
    Jan Tielens
    Apr 19, 2004
  3. Francois Vanderseypen

    Tivoli authentication, webservices and .Net

    Francois Vanderseypen, Apr 20, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    130
    Dino Chiesa [Microsoft]
    Apr 22, 2004
  4. j_a5

    Forms authentication in WebServices and timeout

    j_a5, Sep 29, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    133
  5. Jeremy

    Webservices Basic Authentication Bottlenecks

    Jeremy, Nov 3, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    119
    Jeremy
    Nov 3, 2004
Loading...

Share This Page