Why "Permission denied", How to fix it?

  • Thread starter Thread starter FD
  • Start date Start date
F

FD

A COM was used in VBscript and worked fine.
Now I try to use C# to call it with following code:

Type myType = Type.GetTypeFromProgID("MyProgID");
object myObj = Activator.CreateInstance(myType);
Object myResult = myType.InvokeMember("MyFunction",
BindingFlags.DeclaredOnly | BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.Instance |
BindingFlags.InvokeMethod, null, myObj,
new Object[] {myParam});

The 3rd line code got an error: "Permission denied".

Any idea, how fix it?
Thanks,
FD
 
Try to play with different sets of BindingFlags. I wonder if removing
"NonPublic" would help...

Val.
 
FD wrote:
|| A COM was used in VBscript and worked fine.
|| Now I try to use C# to call it with following code:
||
|| Type myType = Type.GetTypeFromProgID("MyProgID");
|| object myObj = Activator.CreateInstance(myType);
|| Object myResult = myType.InvokeMember("MyFunction",
|| BindingFlags.DeclaredOnly | BindingFlags.Public |
|| BindingFlags.NonPublic | BindingFlags.Instance |
|| BindingFlags.InvokeMethod, null, myObj,
|| new Object[] {myParam});
||
|| The 3rd line code got an error: "Permission denied".
||
|| Any idea, how fix it?
|| Thanks,
|| FD

What's the identity/security context of the user running this code (aspnet or other)?
What does MyProgID refer to (exec server or a DLL)?

Willy.
 
-----Original Message-----
FD wrote:
|| A COM was used in VBscript and worked fine.
|| Now I try to use C# to call it with following code:
||
|| Type myType = Type.GetTypeFromProgID("MyProgID");
|| object myObj = Activator.CreateInstance(myType);
|| Object myResult = myType.InvokeMember("MyFunction",
|| BindingFlags.DeclaredOnly | BindingFlags.Public |
|| BindingFlags.NonPublic | BindingFlags.Instance |
|| BindingFlags.InvokeMethod, null, myObj,
|| new Object[] {myParam});
||
|| The 3rd line code got an error: "Permission denied".
||
|| Any idea, how fix it?
|| Thanks,
|| FD

What's the identity/security context of the user running this code (aspnet or other)?
What does MyProgID refer to (exec server or a DLL)?

Willy.


.

This is a aspnet app to call "MyProgID" - which is a VB6
dll and was registered.
Did I miss some setting?
Thanks,
FD
 
Back
Top