How I can create COM object with predefined credentials ?

  • Thread starter Thread starter Maxim Kazitov
  • Start date Start date
M

Maxim Kazitov

Hi,

How I can create COM object with predefined credentials ?

Actually I have following problem, I should create COM object from my .Net
WebService, this COM object should have right to some folders, but
unfortunately given COM implement apartment model and impersonation doesn't
help.

Max
 
Max,

If you want to impersonate credentials, I would recommend looking at the
documentation for the ImpersonateMethod on the WindowsIdentity class. It
will show how you can call LoginUser and the Impersonate method to run under
the specified user account.

Or, you can set the <identity> tag in the web.config file for the
directory your service is running in, but this might pose a problem if you
have other services in the directory.

Also if the COM object runs in a STA, then you need to set the thread
that your code runs on to use that same apartment state. Doing this,
however, will cause performance to suffer, so you should try and recode the
functionality in .NET, if possible.

Hope this helps.
 
Back
Top