Security Issue

  • Thread starter Thread starter web1110
  • Start date Start date
W

web1110

Hi,

I set up my wifes machine to run .NET, some of my stuff runs but not all.

First example:

I have a windows program that displays environment info. It runs fine on my
machine. Whan I run it on my wifes' machine over the network it fails on
the statement:

values.Add ("WorkingSet: " + System.Environment.WorkingSet.ToString());

It gave the error message (most of it is shown):

The application attempted to perform an operation not allowed by the
security policy. The operation required the SecurityException. To grant
this application the required permission ... or use the Microsoft .net
security policy administratiopn tool

Request for the permission of type
System.Security.Permissions.EnvironmentPermissions, mscorlib
Version n1.0.5000.0 Culture=neutral
Public key token ... failed

How do I get round this?

Thanx,
Bill
 
.NET introduces a new layer of security called Code Access Security (CAS). CAS isn't concerned with *who* is running the code but rather what are the origins of the code (physically or author). By default, if you run code from your local hard disk then the code runs with fulltrust. This means that CAS will not limit what the code can do (although you are still of course constrained by the operating system security infrastructure). When you load code from off-machine locations then it runs with a lower level of trust. Code considered to be from the Intranet gets more permissions than code from the Internet, but is still very limited in what it is allowed to do *by default*.

What is happening is that you are running the code acorss the network so the code is probably considered to be on the intranet. Obtaining the working set is not allowed by default from the intranet. There are a number of ways to fix this of increasing complexity but apart from 1) they increasingly cut down teh security implications of changing policy as they become more focussed:

1) copy the .exe to your wifes machine and run it from the hard disk

2) go into the .NET Configuration tool (look in admin tools in control panel) and in the security settings set the intranet zone permissions to fulltrust

3) go into the .NET Configuration tool (look in admin tools in control panel) and in the security settings set up a Code Group mapping the URL of the location the code is running from to FullTrust

4) ) go into the .NET Configuration tool, create a new permission set that grants the environment permission (and any others that turn up as security exceptions and map the URL of the code to this new permission set via a code group

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

Hi,

I set up my wifes machine to run .NET, some of my stuff runs but not all.

First example:

I have a windows program that displays environment info. It runs fine on my
machine. Whan I run it on my wifes' machine over the network it fails on
the statement:

values.Add ("WorkingSet: " + System.Environment.WorkingSet.ToString());

It gave the error message (most of it is shown):

The application attempted to perform an operation not allowed by the
security policy. The operation required the SecurityException. To grant
this application the required permission ... or use the Microsoft .net
security policy administratiopn tool

Request for the permission of type
System.Security.Permissions.EnvironmentPermissions, mscorlib
Version n1.0.5000.0 Culture=neutral
Public key token ... failed

How do I get round this?

Thanx,
Bill
 
Back
Top