Impersonate user for webservice status 401

Discussion in 'ASP .Net Web Services' started by jacques@designfault.co.uk, Dec 5, 2006.

  1. Guest

    I'm connecting to a web service from an asp.net page and trying to pass
    the current asp.net page requesting user credentials to the web
    service. My problem is a keep getting a 401 error from the web service,
    when I check the log files of the server where the web service resides
    I can see no user account details have been passed.

    I have the web.config set as follows for the asp.net page consuming the
    web service:

    <authentication mode="Windows">
    </authentication>
    <authorization>
    <allow users="*" />
    <deny users="?" />
    </authorization>
    <identity impersonate="true"/>

    When I check System.Threading.Thread.CurrentPrincipal.Identity.Name
    before the web service call I see the username I'd expect.

    I'm Setting the Web service credentials as follows:

    WebService.Credentials = System.Net.CredentialCache.DefaultCredentials

    >From what I have read from MSDN and from other group posts this should

    work and the users Credentials should be passed to my web service but I
    still get a 401 status back and I can see that no user details are
    passed to my web service.

    I'm starting to pull me hair out over this, any help to stop me going
    bald would be very much appreciated!

    Jacques.
     
    , Dec 5, 2006
    #1
    1. Advertising

  2. Catalin T Guest

    Jacques,
    Try this

    WebService..PreAuthenticate=true;


    Catalin


    "" wrote:

    > I'm connecting to a web service from an asp.net page and trying to pass
    > the current asp.net page requesting user credentials to the web
    > service. My problem is a keep getting a 401 error from the web service,
    > when I check the log files of the server where the web service resides
    > I can see no user account details have been passed.
    >
    > I have the web.config set as follows for the asp.net page consuming the
    > web service:
    >
    > <authentication mode="Windows">
    > </authentication>
    > <authorization>
    > <allow users="*" />
    > <deny users="?" />
    > </authorization>
    > <identity impersonate="true"/>
    >
    > When I check System.Threading.Thread.CurrentPrincipal.Identity.Name
    > before the web service call I see the username I'd expect.
    >
    > I'm Setting the Web service credentials as follows:
    >
    > WebService.Credentials = System.Net.CredentialCache.DefaultCredentials
    >
    > >From what I have read from MSDN and from other group posts this should

    > work and the users Credentials should be passed to my web service but I
    > still get a 401 status back and I can see that no user details are
    > passed to my web service.
    >
    > I'm starting to pull me hair out over this, any help to stop me going
    > bald would be very much appreciated!
    >
    > Jacques.
    >
    >
     
    Catalin T, Dec 7, 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. =?Utf-8?B?RGh3YW5pbCBTaGFo?=

    Sending Status as 401.1

    =?Utf-8?B?RGh3YW5pbCBTaGFo?=, Feb 23, 2004, in forum: ASP .Net
    Replies:
    8
    Views:
    5,468
    Fixme
    Jun 6, 2008
  2. =?Utf-8?B?UG1jZw==?=

    HttpWebRequest & (401) Unauthorized http status code

    =?Utf-8?B?UG1jZw==?=, Jun 21, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    2,418
    =?Utf-8?B?UG1jZw==?=
    Jun 21, 2004
  3. =?Utf-8?B?UGhpbDM5Ng==?=

    WS status 401:Unauthorized

    =?Utf-8?B?UGhpbDM5Ng==?=, Aug 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    466
    John Timney \(ASP.NET MVP\)
    Aug 22, 2005
  4. Bill Belliveau

    DirectoryEntry Impersonate or WindowsIdentity Impersonate?

    Bill Belliveau, Jan 28, 2004, in forum: ASP .Net Security
    Replies:
    3
    Views:
    351
    Joe Kaplan \(MVP - ADSI\)
    Jan 31, 2004
  5. Howard Hoffman

    HTTP Status 401 -- WebServer calling WebService

    Howard Hoffman, Sep 10, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    177
    Howard Hoffman
    Sep 10, 2003
Loading...

Share This Page