Solved

Visual Basic .NET Security Error on Shared or Mapped network drive ?

Posted on 2007-11-18
5
879 Views
Last Modified: 2013-11-07
Visual Basic .NET compiled in Visual Studio 2005.
Using .NET version 2.0.50727.42

When running a Visual Basic compiled application on a Shared network or mapped drive the following security error occurs:

Application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission contact your system administrator, or use the Microsoft .NET Framework Configuration tool.
[ Details ]
<configuration>
  <system.windows.forms.jitDebugging="True"/>
</configuration>

 ...
0
Comment
Question by:siacom
  • 2
  • 2
5 Comments
 
LVL 10

Expert Comment

by:MrClyfar
ID: 20309361
Hi there.

What you are experiencing there is the result of code groups. Basically, when running a .NET app on your computer the runtime uses code groups to work out what permissions the .NET assembly has. In this example you can't run a .NET assembly from a network drive.

To get around this problem, copy the .NET assembly from the shared drive and run it locally on your PC. That would work.

The other way around this is to open up Microsoft .NET Framework 2.0 Configuration (found in Control Panel-Administrative Tools). From there you can control what permissions a .NET must have in order to run on your PC. I'm sorry I can't be of much more help, but if someone else could take the reigns and explain how to configure the code group/policy.

Jas.
0
 

Author Comment

by:siacom
ID: 20309391
I have no problem running the application on a local drive.

Ok, so there no way of running an application on a network mapped drive >?

I wanted to do this for a user, so that he can use the application as I complete it. It would be faster and easier for me to compile it to a network drive..
0
 
LVL 10

Accepted Solution

by:
MrClyfar earned 500 total points
ID: 20309472
Hi again.

You can configure the computer's policy to allow the running of .NET assemblies from a network drive, but I;m unfamiliair with actual process of doing that, sorry about that. All I can do is guide to the possible area where the problem lies i.e. the configuration manager for .NET 2.0.

If you Google for ".NET configuration netowkr drive" then you might get some articles explaining how to do this.

Sorry I can't be of more hlep.
Jas.
0
 

Author Comment

by:siacom
ID: 20309925
ok thanks for your help MrClyfar I'll try Google otherwise I'll do the reverse and map the users local drive as my output folder :)

0
 
LVL 2

Expert Comment

by:andrewneely
ID: 20312501
You can run a dot net app from a network.  The issue is code access security.  There are several work arounds.  First is copy the app to the local drive to run.  I put out applications for our office on our network share, and use a batch file to copy the exe on to the local machine each time it runs.  That way, any updates will be pulled down.

Another solution is to use the dot net configuration utility.  What you would need is to grant the network share "FULL TRUST".  

A third option is to use the CASPOL utility found in the windows\microsoft.net\framework\"version", where Version is the dot net version for which you want to modify the trust settings.

Note that modifying the dot net configuration utility (start-settings-control panel - Administrative tool) and caspol require at least power user access.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question