Compartilhar via


Caspol -s Behavioral changes for Whidbey

We generally use "caspol.exe -s off" as a quick test to determine if .NET framework security plays a part in problems with managed components.  It used to be that sometimes people would forget to run "caspol.exe -s on" to turn framework security on.  Imagine all the nasties that could infect your box then!

Well, in Whidbey things are different.  Now when you run caspol to turn off .NET framework security you see this in the console window:

c:\Program Files\Microsoft Visual Studio 8\VC>caspol -s off
Microsoft (R) .NET Framework CasPol 2.0.50603.0
c Microsoft Corporation. All rights reserved.

CAS enforcement is being turned off temporarily. Press <enter> when you want to
restore the setting back on.

So, now there's chance that security will be comprimised by you forgetting to turn security off since it's temporary.  You may ask what happens if caspol terminates unexpectedly?  Good question, I tested it!

If caspol.exe terminates before you hit <enter> to turn security back on it will revert to the ON state.   Here's another side note, running caspol -s on doesn't do anything.  You'll see this for output when you try turn security on:

 

c:\Program Files\Microsoft Visual Studio 8\VC>caspol -s on
Microsoft (R) .NET Framework CasPol 2.0.50603.0
c Microsoft Corporation. All rights reserved.

Because security can no longer be turned off, turning on security does not have
any effect.
Success