开发者

Exception Production in os vista

开发者 https://www.devze.com 2023-01-19 08:04 出处:网络
Why make an exception in the code is not : try { FileIOPermission FIP = new FileIOPermission(FileIOPermissionAccess.Write, @\"c:\\SD.txt\");

Why make an exception in the code is not :

try
{

FileIOPermission FIP = new FileIOPermission(FileIOPermissionAccess.Write, @"c:\SD.txt");


FIP.Demand();//Exception must rise here

StreamWriter SW = new StreamWriter(@"c:\SD.开发者_JAVA技巧txt");//but Exception rise here
SW.Write(textBox1.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

The following code should generate an exception in Windows Vista do

   FIP.Demand();//Exception must rise here

Why not create?

My OS : Vista


You are checking code execute permissions, not actual file permissions.

0

精彩评论

暂无评论...
验证码 换一张
取 消