What is the C# equivalent of calling CoInitializeSecurity?

G

Guest

Hi there

We have a complicated security set up using a COM+ scenario and all our client programs call CoInitializeSecurity at the beginning of the process to get everything working correctly

However we have a requirement to use .NET client apps as well and cant find the C# way of initialising the security for use with COM+

Pease help
Arron
 
V

Valery Pryamikov

Hi,
You need to use P/Invoke to call CoInitializeSecurity from C#. Alternatively
you may think of using MC++ for this kind of tasks.
One thing that worth to be mentioned here is that CoInitializeSecurity must
be called early during process startup, before any other COM call from this
process.

-Valery.

See my blog at:
http://www.harper.no/valery

Hi there,

We have a complicated security set up using a COM+ scenario and all our
client programs call CoInitializeSecurity at the beginning of the process to
get everything working correctly.
However we have a requirement to use .NET client apps as well and cant
find the C# way of initialising the security for use with COM+.
 
D

Dmitriy Lapshin [C# / .NET MVP]

Side note: you can also use good old CoInitializeSecurity through P/Invoke
in a C# application.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Hi there,

We have a complicated security set up using a COM+ scenario and all our
client programs call CoInitializeSecurity at the beginning of the process to
get everything working correctly.
However we have a requirement to use .NET client apps as well and cant
find the C# way of initialising the security for use with COM+.
 
J

Jeffrey Tan[MSFT]

Hi Arron,

Based on my understanding, you want to do the same work as
CoInitializeSecurity in C#.

====================
Just as the community suggested, you may P/invoke this API in C#.
There is an article shows you how to Use CoInitializeSecurity in Visual
Basic. It may help you:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;239561

Also, you may change your design to use the .Net way of handling COM+. In
..Net Enterprise Services(COM+), System.EnterpriseServices provides security
services to .NET objects that mirror the functionality of the COM+ security
mechanisms and .Net use Role-Based Security (RBS).

For more information, please refer to:
"Role-Based Security (RBS)" section in
"Understanding Enterprise Services (COM+) in .NET"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/ht
ml/entserv.asp

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi Arron,

Does my reply make sense to you?

Please feel free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top