3
Answers

Code Access Security and UAC

Ask a question
Peter

Peter

14y
5k
1
I create a console application (app.exe), with one line:

StreamWriter writer = File.CreateText(@"c:\file.txt");

Then, using caspol, I create a permissionset that states that the members of the permissionset cannot write to the c:\file.txt file, and apply it to a code group. This codegroup is then applied to the console application I just created.

Using mscorcfg.msc to evaluate the assembly, I made sure that app.exe is only affected by this new codegroup - and it is.

If I run this in Win7, with UAC at default - the app crashes, stating that the app didn't have the security permission to write to the file, which is what is to be expected.

However, if I run the app with UAC turned off - the app writes perfectly to the file. No crash, no warning, no nothing.

It's as if turning UAC off completes disables CAS. That can't possibly be right in any way, shape or form

Answers (3)