tags:

views:

78

answers:

1

Hi,

I am a C# .net devoloper.

I have read a lot about Code Access Security(CAS) in .net.

I haven't seen the implementation of this featue on any of the project i have worked on?

Has anyone implemented it?

I read that ALL managed code targetsthe CLR will recieves the benefit of CAS.

What all scenarios we explicitly use code access security in real time?

Thanks

SC

A: 

CAS simply prevents untrusted code from doing something you don't want it to do to a resource you might want to protect.

I think the classic example of where it's required is an untrusted program attempting to access resources on your local PC. In such a case, you can use CAS to grant permissions to this program to do what it needs to do.

I've personally used CAS to grant permissions to a set of (.NET 1.1 and 2.0) applications running from our intranet. These programs might need to perform IO on the workstations running them. Without CAS, I'd get security exceptions when attempting these operations.

You might want to check out this article: Understanding .NET Code Access Security

The article does a better job of explaining this than I did. It also walks you through setting it up.

Jay Riggs