Geeks With Blogs
Blog Moved to Blog Moved to
As I left off last time, I gave a few examples of how to enforce identity security checks via your code.  Now, let's look into the changes for Visual Studio 2005.  This has quite a few advantages over Visual Studio 2003 in terms of having a user interface for specifying basic security attributes.
First off, below is what you would expect when you click on the project properties and browse to the security tab on the left hand side menu.  From here, you have the ability to set whether your project has either full or partial trust.
 From this page, we can go ahead and change this project to a partial trust.  Once you do that, it gives you the option to change the properties of each permission type.  Listed are the permission types that are available to you:
  • EnvironmentPermission
  • FileDialogPermission
  • FileIOPermission
  • IsolatedStorageFilePermission
  • ReflectionPermission
  • RegistryPermission
  • SecurityPermission
  • UIPermission
  • KeyContainerPermission
  • DnsPermission
  • PrintingPermission
  • SocketPermission
  • WebPermission
  • EventLogPermission
  • StorePermission
  • PerformanceCounterPermission
  • OleDbPermission
  • SqlClientPermission
  • DataProtectionPermission
Each of the above permission can be changed if you select the setting to include instead of (Zone Default).  Once you change the setting to Include, you have the ability to customize that permission.  Here is an example of the SecurityPermission Properties Window:
 Unfortunately, you aren't able to use all of the properties for each Attribute from what I can see, especially with regards to SqlClientPermission, but this is a good starting place.  I prefer to do the configuration through the AssemblyInfo.cs as I have many times before.  In the next lesson, I will cover on securing your assembly and more customization of your assembly through permissions.
Posted on Tuesday, May 9, 2006 11:44 AM Microsoft , .NET , C# | Back to top

Comments on this post: .NET Code Access Security for fun and profit Part II

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Matthew Podwysocki | Powered by: