views:

574

answers:

2

Are there some help resources, or can anyone give me a brief Idea how I would configure the .net 2 runtime security policies for the following scenario:

I have a windows forms control hosted in IE. The control tries to read from a serial port and write to the event log. Both of these operations fail due to security restrictions in the browser:

Request for the permission of type 'System.Security.Permissions.SecurityPermission,mscorlib, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b77a5c561934e089 failed.

Request for the permission of type 'System.Diagnostics.EventLogPermission,System, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b77a5c561934e089 failed.

I've set my site to be fully trusted by adding it to the list of fully trusted sites in IE, but I still have the problem. I am pretty sure the answer isin the runtime security policies in the .net 2.0 configuration but I just don't know what to change.

A: 

Since (I assume) you're running under IIS, you need to make sure that your I_USRmachinename account is in a security group that has the permissions you need, or that it is not in a group like "Guests," which would have restricted access to things like the system Event Log. Look at the permissions/groups for your I_USR, I_WAM, and ASP.NET accounts on the system you're trying to run on. I think that's where your problem lies.

AJ
I appreciate the down-vote. Any feedback as to why I got it?
AJ
PITADeveloper, Not sure abut the down vote, I didn't do it, but these permissions we're talking about would be ones on the client machine, what you're talking about are permissions on the server, which I don't think would solve my problem becase the code being restricted is running on the client.
Jeremy
Ah, didn't realize that. Thank you for your insight. I just like to learn, that's all, and a downvote without comment doesn't teach me anything.
AJ
+2  A: 

Try the following:

Control Panel -> Administrative Tools -> Microsoft .NET Framework 2.0 Configuration

Expand out and select:

.Net Framework 2.0 Configuration -> MyComputer -> Runtime Security Policy -> Machine -> Code Groups -> All_Code

Under that there are the different zones. I'm not sure which one would apply to IE and your scenario, but try the following on each of them (remember to set them back after testing)

Right click on the "??????_Zone" Select the "Permission Set" Tab Change the "Permission Set" combo to "Full Trust"

The "Membership Permission" tab may also lend some clues to which one is correct.

Info on Code Access Security

Robert Wagner
Wanted to write the same as you, but didn't find Microsoft .NET Framework 2.0 Configuration on my machine... :) weird..
badbadboy
Yeah, there's only Microsoft .NET Framework 1.1 Configuration despite I've got all of them installed and I'm an administrator. Would like to know the answer as well!
GSerg
Looks like you have a common problem. See http://home.hot.rr.com/graye/Articles/CodeAccessSecurity.htm#Install
Robert Wagner
>> Looks like you have a common problemToo common then. I've got VS2008 on my PC and there's no 2.0 Configuration applet, I've got VS2008 on work PC and it's no applet as well, and I've got VS2008 on yet another PC which didn't previously had VS2005 and still no applet. I'm confused.
GSerg