0

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 by Reverend Jim: Fixed formatting

2
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by serkan sendur
0

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

0

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.

0

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?

0

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?

0

>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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.