Impersonation failing when accessing another assembly

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

  1. #1

    Default Impersonation failing when accessing another assembly

    Hi, I've written an ASP.NET web service which impersonates a user
    designated by the end user, then calls into another .NET assembly
    to copy a file from a network share to a local drive. The assembly
    throws the exception "Could not find file [unc path]." I added
    code to determine the current identity as follows:

    WindowsIdentity.GetCurrent().Name

    This code returns [Domain name]\ASPNET, which tells me the code is
    not running under the impersonated account, but the ASPNET account.

    I even tried adding code to impersonate the same account within the
    assembly in question, but the results are the same - the code insists
    on running under the ASPNET account.

    I can't seem to find anyone else having similar issues, but then I
    cant't find documentation that indicates I should be able to do this
    either.

    This is on a Windows Server 2003 machine.

    Can anyone confirm that an assembly called from an ASP.NET application
    using impersonation will also run using the impersonated account?

    I'm convinced it's a configuration issue, but can't seem to find a fix.
    Thanks,
    Chris

    CBran Guest

  2. Similar Questions and Discussions

    1. Assembly acessing StrongNamed assembly getting "Access Denied" intermitently
      I have an ASP.NET application that is using a code library our development team uses. The code library is a few web controls in a Strong Named...
    2. Impersonation fails when accessing remote files.
      I am impersonating a user by setting the details in Web.config. I have confirmed that the .aspx page is running as the impersonated user. I then...
    3. Reading the public key inside a strongly signed assembly from the assembly itself???
      Hello, is it possible to programmatically read (and how) the public key that is embedded into an assembly that has been strongly signed??? What...
    4. assembly directory
      I need to add an additional directory to search for assemblies other than the "bin" directory.... how do I do this in the web.config file?
    5. GAC assembly with ASP.NET
      There's no need to put your Class Library in the GAC, give it a strong name, etc., BTW. You can just put a copy of the DLL in the /bin folder of...
  3. #2

    Default Re: Impersonation failing when accessing another assembly

    Hello CBran,
    Im assuming youve set impersonate to true. Are you setting the client credentials
    in the client application to the desired user?

    HTH
    Regards,
    Dilip Krishnan
    MCAD, MCSD.net
    dkrishnan at geniant dot com
    [url]http://www.geniant.com[/url]
    > Hi, I've written an ASP.NET web service which impersonates a user
    > designated by the end user, then calls into another .NET assembly to
    > copy a file from a network share to a local drive. The assembly
    > throws the exception "Could not find file [unc path]." I added code
    > to determine the current identity as follows:
    >
    > WindowsIdentity.GetCurrent().Name
    >
    > This code returns [Domain name]\ASPNET, which tells me the code is not
    > running under the impersonated account, but the ASPNET account.
    >
    > I even tried adding code to impersonate the same account within the
    > assembly in question, but the results are the same - the code insists
    > on running under the ASPNET account.
    >
    > I can't seem to find anyone else having similar issues, but then I
    > cant't find documentation that indicates I should be able to do this
    > either.
    >
    > This is on a Windows Server 2003 machine.
    >
    > Can anyone confirm that an assembly called from an ASP.NET application
    > using impersonation will also run using the impersonated account?
    >
    > I'm convinced it's a configuration issue, but can't seem to find a
    > fix.
    > Thanks,
    > Chris

    Dilip Krishnan Guest

  4. #3

    Default Re: Impersonation failing when accessing another assembly

    Dilip,

    Thanks for the reply. If you are asking if we are setting impersonate
    to true in the web.config file, then NO, we are not.
    We are impersonating entirely through code. When you say "client
    credentials" I think you are referring to the CredentialCache.
    We are not utilizing the CredentialCache at all.

    Thanks again,
    Chris

    CBran Guest

  5. #4

    Default Re: Impersonation failing when accessing another assembly

    Hello CBran,
    You would need to set the impersonate in web.config to true and use the
    the Credentials property on the client and set it to an appropriate credential
    that has permissions
    [0] - [url]http://msdn.microsoft.com/library/en-us/cpguide/html/cpconaspnetimpersonation.asp[/url]
    [1] - [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wse/html/1a633f76-5173-40d8-8dfb-5fdba063e6e8.asp[/url]
    HTH
    Regards,
    Dilip Krishnan
    MCAD, MCSD.net
    dkrishnan at geniant dot com
    [url]http://www.geniant.com[/url]
    > Dilip,
    >
    > Thanks for the reply. If you are asking if we are setting impersonate
    > to true in the web.config file, then NO, we are not.
    > We are impersonating entirely through code. When you say "client
    > credentials" I think you are referring to the CredentialCache.
    > We are not utilizing the CredentialCache at all.
    > Thanks again,
    > Chris

    Dilip Krishnan 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