Impersonation in asp.net not shared with com object
So I have an ASP DOT NET web service which needs to impersonate Windows Authenticated users. This web service calls into a Com Api to perform database operations.
It seems like the Impersonation does not persist into the Com Api. Is this because the Com DL开发者_运维百科L is loaded into its own memory space and treated as a separate process? Also what would be some ways to deal with this issue and persist the Impersonation into the Com Api Dll?
Moving the functionality of the Com Api into the dot net code is not an option at this point. Also the Com Api was written in C++.
So I fixed the problem. The Com Object is loaded into its own thread and Impersonation being set the way I did is Thread level. Since I have control of the Com Object adding the Windows function CoImpersonateClient(); before any code that needed to be impersonated did the trick.
Here is the article I finally found that resolved the problem:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q325791
精彩评论