Why do I need to Demand permission? Why can’t it simply fail (commenting out the .Demand() call)?
ref: http://support.microsoft.com/kb/315529
Thanks!
try
{
// Demand the permission to access the C:\Temp folder.
permFileIO.Demand();
resultText.Append("The demand for permission to access the C:\\Temp folder succeeded.\n\n");
}
— edit 1 —
I read somewhere that CAS is going away because it is a pain to configure. Is this correct?
You do not need the demand.
If you remove it and you have security restrictions it will simply throw a security exception.
The advantage of the demand is that the runtime can determine the exact rights needed by your application (e.g. that it needs FileIOPermission for a specific directory) and then let the user/admin configure that.