Solved

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

Posted on 2008-10-28
8
630 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
  • 4
  • 3
8 Comments
 
LVL 25

Expert Comment

by:SStory
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:rlpjr
Comment Utility
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 25

Expert Comment

by:SStory
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now