-
C# (
http://www.daniweb.com/forums/forum61.html)
| Shalvin | Feb 26th, 2008 6:05 am | |
| Using Code Access Security (CAS) to programatically refuse writing to a drive - Shalvin CAS is the programatically means by which you secure the resouce of a system like file system, printer, registry, etc. in contrast to Role Base Security (RBS) |
using System.Security.Permissions;
using System.Security;
using System.IO;
[assembly: FileIOPermissionAttribute(SecurityAction.RequestRefuse , Write="d:\\")]
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
StreamWriter sw;
private void button1_Click(object sender, EventArgs e)
{
sw = File.CreateText("d:\\Shalvin.txt");
sw.WriteLine("Hello");
sw.Close();
}
| All times are GMT -4. The time now is 2:09 pm. | |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC