Solved

File Permissions and CAS

Posted on 2009-05-19
4
197 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
Comment Utility
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
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This is a guide to the following problem (not exclusive but here) on Windows: Users need our support and we supporters often use global administrative accounts to do this. Using these accounts safely is a real challenge. Any admin who takes se…
SHARE your personal details only on a NEED to basis. Take CHARGE and SECURE your IDENTITY. How do I then PROTECT myself and stay in charge of my own Personal details (and) - MY own WAY...
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

11 Experts available now in Live!

Get 1:1 Help Now