Solved

Using Main(Environment.GetCommandLineArgs()) from network drive

Posted on 2008-10-28
8
637 Views
Last Modified: 2012-05-05
I have a program that looks for any comand line switches on the compiled exe.  Everything works fine as long as I run the program from one of my local drives  When I try to run the program from one of my network drives I get the error inside a Microsoft .net framework box that says "Application attempted to perform an operation not allowd by the security policy.  to grant this application the required permission, contact your systm administrator, or use the Microsoft .NET Framework Configuration Tool.  If you click continue, the application will ignore this error and teempt to continue.  If you click quit, the applicaion will close immediately.
Request for the permission of type 'system.security.persmissions.environmentpermission, mscorlib, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089'

Any help on fixing this problem would be greatly appreciated.
0
Comment
Question by:rlpjr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 25

Expert Comment

by:SStory
ID: 22826379
If the application is not running on the same machine that you are on...which is your case, then you will need to go to Control Panel, Administrative Tools, Microsoft .Net Framework x.x Configuration.

Click Applications
Then to the right, click on Add an Application to Configure

.
0
 
LVL 25

Expert Comment

by:SStory
ID: 22826439
Maybe it would be better to just click on the Runtime Security Policy node
Then in the list in the right pane, click on Increase Assembly Trust, then click OK on the form that appears and browse to the assembly in question.

Anyone who runs your app in this manner from any machine would have to have an admin grant this Code Access Trust.
0
 

Author Comment

by:rlpjr
ID: 22831505
SStory
I must be doing something wrong because I did what you said in the first comment and it did nothing I am still getting the error.  The second one I really don't understand what you want me to do.  If you could walk me through it a little more maybe I will understand.  Thank you for your help.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rlpjr
ID: 22831592
SStory
I also noticed that I have several net framework configuration under administration version version 1.1 configuration. Version 1.1 wizard and version 2.0 configuration.  I looked in my program and it says that I am using version 2.0.5.072 but when I go under that one there is no application to click on to add my application.  Any ideas on this?
0
 
LVL 25

Expert Comment

by:SStory
ID: 22834064
Go under the 2.0 version

Highlight MyComputer node...then in the links that appear below, click on
Configure Code Access Security Policy

then under the Runtime Security Policy node
Try Increase Assembly Trust
0
 

Author Comment

by:rlpjr
ID: 22835087
SStory
I did all that then it comes up with a box that says
"Enter the path or url to a managed assembly to trust"  I chose my .exe form my project but that did not like that so what am I suppose to put in there?  
0
 
LVL 41

Accepted Solution

by:
graye earned 500 total points
ID: 22840290
Here is an article that explains it all... and has examples on how to correct this problem via the control panel or via the command-line tool
http://home.hot.rr.com/graye/Articles/CodeAccessSecurity.htm 
0
 
LVL 25

Expert Comment

by:SStory
ID: 22840413
It has been a while since I have done this.  I did point you to the right tool. It is obviously less than intuitive to use.  The link provided by graye seems to tell you how to get it working.
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 is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
WARNING:   If you follow the instructions here, you will wipe out your VTP and VLAN configurations.  Make sure you have backed up your switch!!! I recently had some issues with a few low-end Cisco routers (RV325) and I opened a case with Cisco TA…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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