System.Security.SecurityException thrown when running app from network drive.

  • Thread starter Thread starter David Lindgren
  • Start date Start date
D

David Lindgren

Hello!

When I am trying to run my .NET application from a network drive a
System.Security.SecurityException exception is thrown. Why is that? How do I
prevent it?

Thanks!

/David.
 
Hi David,

Programs run from network locations are executed with tighter security
restrictions than those run from local computer. I suggest that a program
run from a network falls into the "Local Intranet" code group which has
quite a limited set of permissions. As far as I know, there is no
programmatic way to overcome that. Instead, start the .NET Framework
Configuration tool and add more permissions for the corresponding code
group. You will obviously have to do so for each computer you expect to run
this program from a network on.
 
The reason is because of the different security zones that .NET uses. For
instance, a programming running from another website has almost no local
privileges while those running from a local drive are god-like. When you
run from another share, you are running from an Intranet which has less
rights. Most likely you are receiving the error because you are trying to
do something that an Intranet application is not allowed to do be default.

To solve this you will need to change the .NET configuration for each
machine that this application will run from. You will need to run the .NET
Framework Configuration tool and adjust the Runtime Security Policy to give
you assembly more trust in your environment.
 
Back
Top