ActiveX Security Zone

Fork501

Active member
Joined
Jan 27, 2007
Messages
41
Location
Weston, Florida
Hi, all!

I was wondering if anyone knows how to adjust the granted security zone for a .NET ActiveX control?

I am currently working on a project that will allow me to list my users tasks in Outlook, but am unable to run the control without giving the security zone its part of unrestricted access.

When I launch it locally, it is part of the Intranet zone. When I launch it for my users, it will be part of the Internet zone. Unfortunately, neither of these are desierable, as I need the MyComputer zone.

I would honestly have no problems with launching this in the Intranet zone and setting each user up with the proper security, since anything launched under Intranet will be created by me, either way.

I have tried putting the following line in the AssemblyInfo.cs file for the ActiveX control:

Code:
[assembly: AllowPartiallyTrustedCallersAttribute]

That doesnt do anything at all. I have even tried putting the following line at the top of my class declaration:

Code:
[ZoneIdentityPermission(SecurityAction.Demand, Zone=SecurityZone.Intranet)]

Unfortunately, the control wont even load when launched in a web page.

Ive hit a brick wall here and cant figure this out :confused:

My only other option is to find the DLL file somewhere in the Internet Explorer cache and grant the assembly full access privilages, but I wouldnt even know WHERE to look for that and if it would allow itself to remain with the access, if I make any changes.

Any help would be GREATLY appreciated!

Thank you in advance!

~Derek
 
Well I finally came up with a solution! =)

In the constructor for my object, I added the following lines:

Code:
SecurityPermission sp = new SecurityPermission(PermissionState.Unrestricted);
sp.Assert();

I then signed my project with a strong name and increased the Assemblys trust with the .NET Framework 2.0 Configuration utility.

I will make a quick note that I have two object files in my project, because I have 2 sections to this application. I made both of those objects derive from the same base class. I was attempting to have the code placed in constructor of the base class, but this was not working at all. Once I put the code in the constructor for the derived class, everything worked perfectly!

Thanks anyways =)

~Derek
 
Back
Top