Start a .NET assemby from a network drive

  • Thread starter Thread starter Gerda
  • Start date Start date
G

Gerda

Hi!

I developed a VB.NET Programm which I always started from
a local disk!

The customer wants to start the program from a network
drive. When I start the program from the network drive I
receive always an exception -> 'request for permission of
type System.Security.Permissions.SecurityPermission [...]
PublicKeyToken=b77a5c[..] failed'.

I guess I have to set some security permissions with the
MMC snap-in '.NET-Configuration'. Is that rigtht? What do
I have to do? Do you know any documents (best practise) or
sample to get to know what's to do without learning the
full .NET security stuff?

Gerda
 
The customer wants to start the program from a network
drive. When I start the program from the network drive I
receive always an exception -> 'request for permission of
type System.Security.Permissions.SecurityPermission [...]
PublicKeyToken=b77a5c[..] failed'.

I guess I have to set some security permissions with the
MMC snap-in '.NET-Configuration'. Is that rigtht? What do
I have to do? Do you know any documents (best practise) or
sample to get to know what's to do without learning the
full .NET security stuff?

The .NET security stuff is important to learn, but I can get you started
since I had to do something similar. Where I work, everyone gets a
storage directory on a network share that is automatically mapped to the
U: drive.

Start up the .NET Configuration and go to the 'Runtime Security Policy'.
Under that will be three entries: Enterprise, Machine and User. You
need to determine where to make your changes.

Pick the appropriate enter and open the tree. Then open the "Code
Groups" entry and then "All Groups" (that last one should be empty).
Right-click on "All Groups" and select "New...".

- Pick Create a new code group. Give it a name and description. I
called it "Network code". Click Next.

- Now you need to define the "membership condition" i.e. what defines
the code group. I changed the dropdown to "URL" and entered:

file://U:/*

- Click next and then pick an existing permission set. I used FullTrust
so it would have the same permissions as my local hard drive.

That should get you the proper permission to execute code on a network
share.
 
Patrick is exactly right. If you'd prefer not to allow full trust to everything mapped to the U drive, you could instead trust a public key that you sign
your assembly with. Details are here:

http://blogs.gotdotnet.com/shawnfa/PermaLink.aspx/40884dc9-dbb7-48e7-a70f-5f1f4627410c

-Shawn

--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they
originated.
--------------------
From: Patrick Steele [MVP] <[email protected]>
Subject: Re: Start a .NET assemby from a network drive
Date: Thu, 13 Nov 2003 09:19:20 -0500
Message-ID: <[email protected]>
References: <[email protected]>
X-Newsreader: MicroPlanet Gravity v2.60
Newsgroups: microsoft.public.dotnet.framework
NNTP-Posting-Host: 209.69.88.157
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework:58770
X-Tomcat-NG: microsoft.public.dotnet.framework

The customer wants to start the program from a network
drive. When I start the program from the network drive I
receive always an exception -> 'request for permission of
type System.Security.Permissions.SecurityPermission [...]
PublicKeyToken=b77a5c[..] failed'.

I guess I have to set some security permissions with the
MMC snap-in '.NET-Configuration'. Is that rigtht? What do
I have to do? Do you know any documents (best practise) or
sample to get to know what's to do without learning the
full .NET security stuff?

The .NET security stuff is important to learn, but I can get you started
since I had to do something similar. Where I work, everyone gets a
storage directory on a network share that is automatically mapped to the
U: drive.

Start up the .NET Configuration and go to the 'Runtime Security Policy'.
Under that will be three entries: Enterprise, Machine and User. You
need to determine where to make your changes.

Pick the appropriate enter and open the tree. Then open the "Code
Groups" entry and then "All Groups" (that last one should be empty).
Right-click on "All Groups" and select "New...".

- Pick Create a new code group. Give it a name and description. I
called it "Network code". Click Next.

- Now you need to define the "membership condition" i.e. what defines
the code group. I changed the dropdown to "URL" and entered:

file://U:/*

- Click next and then pick an existing permission set. I used FullTrust
so it would have the same permissions as my local hard drive.

That should get you the proper permission to execute code on a network
share.
 
Back
Top