| | |
Using Code Access Security (CAS) to programatically refuse writing to a drive - Shalvin
Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
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(); }
Similar Threads
- DVD-RW drive not writing nor burning (Storage)
- Drive Access Denied After Using USB Flash Drive (Storage)
- Getting a button's code to run programatically (VB.NET)
- Writing to hard drive? (C#)
| Thread Tools | Search this Thread |
.net access algorithm animation array bitmap box c# check checkbox client combobox control conversion csharp customactiondata database datagrid datagridview dataset datastructure date/time datetime datetimepicker degrees directrobot dll draganddrop drawing encryption enum excel file filename files form format formbox forms function gdi+ gis gtk hash image input install java label list mandelbrot math mouseclick mp3 mysql native operator outlook2003 packaging path photoshop picturebox pixelinversion pixelminversion post print process programming radians regex remoting richtextbox safari server sleep snooze socket sql statistics string table tables tcp text textbox thread time timer update usercontrol usercontrols validation visualstudio webbrowser webcam wfa wia winforms wpf xml



