Passing credentials problem

Discussion in 'ASP .Net Web Services' started by porter_wss@hotmail.com, Feb 11, 2005.

  1. Guest

    I am at a loss. I have a web service which uses Windows Integrated
    Security.

    If I use the following code to call my web service:

    WServ wserv = new WServ();
    wserv.Credentials = System.Net.CredentialCache.DefaultCredentials;
    WServDS wservds = wserv.GetWServDS();

    My web service works fine.

    However, when I change to this:

    WServ wserv = new WServ();

    CredentialCache cc = new CredentialCache();
    NetworkCredential nwc = new NetworkCredential("User", "Pass",
    "Domain");

    cc.Add(new System.Uri(wserv.Url), "Negotiate", nwc);
    wserv.Credentials = cc;

    WServDS wservds = wserv.GetWServDS();

    I get a 401, Access Denied. I am creating the same credentials for
    which I am logged in. I do not understand. I have searched all over
    and seem to be doing exactly what is required. Can anyone think of
    what I should check?
    , Feb 11, 2005
    #1
    1. Advertising

  2. Personally i never had luck using new Credential cache. I always ended
    up setting a credential cache equal to the default cache. So you would
    have this:

    CredentialCache cc = System.Net.CredentialCache.DefaultCredentials;

    and then adding my new crediential to it. I used this when dealing
    with Kerberos authentication, and I had a web service proxy factory
    that i wanted to use default user credentials, when I did not want to
    use imperonsation. Not sure this helps any but i thought i would share
    Keenan Newton, Feb 13, 2005
    #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. Steve Drake

    Passing Credentials to WEBDAV

    Steve Drake, Dec 1, 2003, in forum: ASP .Net
    Replies:
    7
    Views:
    4,556
    Bruce Barker
    Mar 3, 2006
  2. Wade Wegner
    Replies:
    8
    Views:
    4,505
    mnvraghuram
    Jun 22, 2007
  3. jadher
    Replies:
    1
    Views:
    3,561
    William F. Robertson, Jr.
    Oct 11, 2004
  4. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    Passing credentials to windows integrated authentication

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 26, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    3,494
    Girish bharadwaj
    Oct 26, 2004
  5. Replies:
    5
    Views:
    3,139
    Nicole Calinoiu
    Jun 8, 2005
Loading...

Share This Page