although my code passes the test below, it cant delete a file and generates unauthorizedaccessexption. do you know why?

FileIOPermission filePermission = new
   FileIOPermission(FileIOPermissionAccess.AllAccess, 
                    @"C:\helloworld.txt");
try
{
   filePermission.Demand();
   MessageBox.Show ("Permission demand successful");
}
catch( SecurityException securityEx )
{
   MessageBox.Show( securityEx.Message, "Security Exception" );
}

Edited 3 Years Ago by Reverend Jim: Fixed formatting

jonh a , instead of giving me ****ing infractions why dont you spare some time to help solve one of my threads?

i solved this problem but it took so long. the file that i was trying to delete was read only. now i use File.GetAttributes and if it is not FileAttributes.Normal, i set it to normal, so i can delete it without a problem. Damn it! i was almost going to crash the PC.

jonh a , instead of giving me ****ing infractions why dont you spare some time to help solve one of my threads?

With an attitude like that, why would I want to?

With an attitude like that, why would I want to?

I dont know how you are able to trace all the posts that i post to find some issues with them. Even 5 days later the post has been posted, you somehow catch my f words or Narue words in it, i am really curious about it, how do you achieve that?

>i am really curious about it, how do you achieve that?
Other members report your posts.

wow, i am flabergasted. how do they benefit from reporting me? do they also report when i solve their threads?

This question has already been answered. Start a new discussion instead.