DefaultCredentials problem?

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default DefaultCredentials problem?

    Hi All,
    this is the scenario:

    - "Hello World" web service on Machine A
    - winform client on Machine B
    - asp.net webform client on Machine B

    Everything is Windows Server 2003 on the same domain, anonymous access
    turned off in IIS, Integrated Windows Authentication is checked. I use the
    following code to invoke the web service (same code on the winform and the
    webform):

    MachineA.Service1 svc = new MachineA.Service1();
    svc.PreAuthenticate = true;
    svc.Credentials = System.Net.CredentialCache.DefaultCredentials;
    string result = svc.HelloWorld();

    The code works from the winform, while I get a "401 Unauthorized" from the
    asp.net webform (I have the impersonate="true" flag set in the web.config
    file of my asp.net application). Now, here is where things get interesting:

    - If I host the web service on MachineB (everything is local), the call
    works fine from the web form.
    - If instead of using DefaultCredentials, I use:

    svc.Credentials = new System.Net.NetworkCredential("username", "password",
    "domain");

    The call works as well. I was looking into the audit trail of MachineA, and
    I've seen that in the case of the webform using DefaultCredentials, the
    actuall logon comes from NT AUTHORITY\ANONYMOUS LOGON instead of being the
    domain user that is running the app. I do not think that it's a delegation
    issue, since I am getting kicked out right at the first hop...

    Any idea would be greatly appreciated, I am close to bang my head against
    the wall for the desperation :(

    - Marco


    Marco Guest

  2. Similar Questions and Discussions

    1. CredentialCache.DefaultCredentials Not working
      I am using the following method to call a web service from a windows application Dim a As New MachineReference.Service1 a.Credentials = s...
    2. 401 Unauthorized when using DefaultCredentials
      Hi all I hope this is the right newsgroup. I'm having a hard time making a web request from an authenticated process. Here's the scenario Managed...
    3. Get DefaultCredentials of one web app into another?
      We have a web app which links to another ASP.NET web application (namely the Microsoft CRM). Our app is launched in a new browser window from a link...
    4. HttpWebRequest, impersonation and DefaultCredentials problem.
      I'm trying to create a HttpWebRequest object that uses the current logged in user's credentials. It's currently setup with: <identity...
    5. DefaultCredentials and WebClient
      I'm trying to make a call inside an ASP.NET web application to an external quasi-web service (aka FrontPage Server Extensions): Dim rpcClient As...
  3. #2

    Default DefaultCredentials problem?

    Hi All,
    this is the scenario:

    - "Hello World" web service on Machine A
    - winform client on Machine B
    - asp.net webform client on Machine B

    Everything is Windows Server 2003 on the same domain, anonymous access
    turned off in IIS, Integrated Windows Authentication is checked. I use the
    following code to invoke the web service (same code on the winform and the
    webform):

    MachineA.Service1 svc = new MachineA.Service1();
    svc.PreAuthenticate = true;
    svc.Credentials = System.Net.CredentialCache.DefaultCredentials;
    string result = svc.HelloWorld();

    The code works from the winform, while I get a "401 Unauthorized" from the
    asp.net webform (I have the impersonate="true" flag set in the web.config
    file of my asp.net application). Now, here is where things get interesting:

    - If I host the web service on MachineB (everything is local), the call
    works fine from the web form.
    - If instead of using DefaultCredentials, I use:

    svc.Credentials = new System.Net.NetworkCredential("username", "password",
    "domain");

    The call works as well. I was looking into the audit trail of MachineA, and
    I've seen that in the case of the webform using DefaultCredentials, the
    actuall logon comes from NT AUTHORITY\ANONYMOUS LOGON instead of being the
    domain user that is running the app. I do not think that it's a delegation
    issue, since I am getting kicked out right at the first hop...

    Any idea would be greatly appreciated, I am close to bang my head against
    the wall for the desperation :(

    - Marco


    Marco Guest

  4. #3

    Default DefaultCredentials problem?

    Hi All,
    this is the scenario:

    - "Hello World" web service on Machine A
    - winform client on Machine B
    - asp.net webform client on Machine B

    Everything is Windows Server 2003 on the same domain, anonymous access
    turned off in IIS, Integrated Windows Authentication is checked. I use the
    following code to invoke the web service (same code on the winform and the
    webform):

    MachineA.Service1 svc = new MachineA.Service1();
    svc.PreAuthenticate = true;
    svc.Credentials = System.Net.CredentialCache.DefaultCredentials;
    string result = svc.HelloWorld();

    The code works from the winform, while I get a "401 Unauthorized" from the
    asp.net webform (I have the impersonate="true" flag set in the web.config
    file of my asp.net application). Now, here is where things get interesting:

    - If I host the web service on MachineB (everything is local), the call
    works fine from the web form.
    - If instead of using DefaultCredentials, I use:

    svc.Credentials = new System.Net.NetworkCredential("username", "password",
    "domain");

    The call works as well. I was looking into the audit trail of MachineA, and
    I've seen that in the case of the webform using DefaultCredentials, the
    actuall logon comes from NT AUTHORITY\ANONYMOUS LOGON instead of being the
    domain user that is running the app. I do not think that it's a delegation
    issue, since I am getting kicked out right at the first hop...

    Any idea would be greatly appreciated, I am close to bang my head against
    the wall for the desperation :(

    - Marco


    Marco Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139