Exception Production in os vista
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.
精彩评论