Last year sometime I tried to use Sytem.Security.Permissions classes to
check if I could write to a file, but it always returned true. I don't have
the code handy, but I tried Assert-catch and things like that but it didn't
tell the truth. I was wasting time so I gave up and in the app startup I
tried to write and delete a small file as a kind of sanity test. It's crude
but it works and I haven't returned to investigate how to do this elegantly.

 

I did mean to read the old Win32 CreateFile API documentation for clues if I
was on the right track or not. I can't remember if there are Win32 API
functions that can test for the ability to create a folder or file without
actually doing it. Can anyone remember? That would be a clue to if it can be
done in .NET or not.

 

Greg

Reply via email to