简体   繁体   中英

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 DLL 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM