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)

45 Views
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();
}
About the Author

Microsoft Professional with more than 10 years of experience.
Coordinator of Cochin .Net User group http://groups.msn.com/cochindotnet

Email : shalvin@gmail.com
Blog : http://shalvinpd.blogspot.com
Site : http://shalvin.com