Link to home
Start Free TrialLog in
Avatar of accits
accits

asked on

File Permissions and CAS

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

Avatar of graye
graye
Flag of United States of America image

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
Avatar of accits
accits

ASKER

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".
ASKER CERTIFIED SOLUTION
Avatar of graye
graye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of accits

ASKER

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