loading assembly and createInstance

D

Daylor

hi.

im loading assembly from my computer and createInstance from it.
till now it worked ok.

now, im changing the path from :

c:\myfolder\myassembly.dll

to

\\mycomputer\myfolder\myassemly.dll


and i get the next exception when CreateInstance:
-------------
A first chance exception of type 'System.Security.SecurityException'
occurred in mscorlib.dll

Additional information: Request for the permission of type
System.Security.Permissions.SecurityPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
--------------

the exception occur when, the code in that assembly is accessed to unmanged
code ( com class).

why is that ? the only diffrence is i change the path like i said from
c:\myfolder\myassembly.dll to \\mycomputer\myfolder\myassemly.dll

i try alots of flags and security permissions, but i dont know where to make
the change.
i have feeling is somthing to the evidence parameter in the assembly.load .


hope someone can help
have a nice day.
 
R

Rob Teixeira [MVP]

Now your code is running with the Intranet permission set. The permission
set zones (local, intranet, internet, etc) are determined by the path of the
assembly.
Do a few searches on Permission Sets and Code Permissions. You can modify
the target machine's config to alter permissions for intranet zone (not
recommended), or you can sign your assembly and give any assembly with that
signing key more permission (recommended).

-Rob Teixeira [MVP]
 
D

Daylor

ok,but i know my problem is permission.
where i can read about setting permissions to assembly ?

im searching for code samples.
or somthing that helps to understand how to change permissions in c#
assembly.
 

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