Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

File Permissions and CAS

Posted on 2009-05-19
4
Medium Priority
?
205 Views
Last Modified: 2013-12-17
Hi,
I need to deploy an application (.exe) on the server, and be able to run it from other computers within the network.  I have built a simple app as a tester which creates a textwriter and saves a simple txt file.  I keep getting the error: "Request for the permission of type 'System.Security.Permissions.FileIOPermission....failed'.  This will occur if I change my code to access a different reference (other than IO), also.  I have done MANY things to try to rectify this, to no avail.  One thing being: I have modified the policy for my local intranet zone to FullTrust (using the .NET 2.0 configuration utility) And this STILL does not work!  I thought that  would be a no-brainer!  Maybe if you guys can help me with this task , I can figure out how to modify the permissions from there.  Maybe I am doing it all wrong?  Here is what I am doing:
Deploy setup file on server from msi
run program on server-works!
switch to networked desktop computer...
run configuration utility and change "machine" local intranet zone to FullTrust
(I also tried creating a new group, setting a URL, and setting it to fullTrust...didn't work)
Try running program from \\myservername\Program Files\myProgram\myProgram.exe
Get the above error!

I have sharing and security wide-open right now...full control from EVERYONE.
pertinent part of the code:
 
using System.IO;
 
private void mymethod()
{
    TextWriter tw = new StreamWriter(@"C:\Program Files\myProgram\logs\log.txt");
            tw.WriteLine(txtBxLog.Text.ToString());
            tw.Close();
}

Open in new window

0
Comment
Question by:accits
  • 2
  • 2
4 Comments
 
LVL 41

Expert Comment

by:graye
ID: 24441467
Yes, this is an example of the .Net Framework's own Code Access Security (CAS) settings on each of the client PCs.
Take a look at the following article that explains it all, and show how to deploy a CAS policy update:  http://www.emmet-gray.com/Articles/CodeAccessSecurity.htm
0
 

Author Comment

by:accits
ID: 24443020
I have looked over the document and am still stumped, as I have already increased my local intranet zone to FullTrust.  I will go over it in more detail and try to troubleshoot.

Is there anything I need to do on the server (windows 2003)?   I am developing the application, then deploying the application on the server, then going back to the development machine to try accessing the application.  It is on the developemt machine that I have configured FullTrust.  I have, for the time being, disabled the firewalls on both machines, and configured sharing and security permissions for the "EVERYONE" users group to "full control".
0
 
LVL 41

Accepted Solution

by:
graye earned 2000 total points
ID: 24443283
No, there's nothing to do on the server...   just make sure you're modifying the CAS settings on each client (using one of the techniques described in the article).  
  • Make absolutely sure that you're using the version 2.0 control panel applet (and not the v1.1 one)
  • Use Windows Explorer to verify that the server is indeed in the LocalIntranet zone on the client PCs
0
 

Author Closing Comment

by:accits
ID: 31583313
thanks graye.  The document you sent helped me to troubleshoot.  It seems as if the server location was added as a "Trusted Site" at some time, and the "Trusted Site" policy was not full trust.  Therefore, even though I went through all of the steps for strong-naming and adding my application to other zones, it was still looking at the wrong policy.  A few corrections, and now it works!
Thanks
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses

916 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