.NET security mechanism to restrict access between two Types in the same Website project?

Posted by jdk on Stack Overflow See other posts from Stack Overflow or by jdk
Published on 2010-05-22T23:38:35Z Indexed on 2010/05/22 23:40 UTC
Read the original article Hit count: 128

Filed under:
|
|
|
|

Question: Is there a mechanism in the .NET Framework to hide one custom Type from another without using separate projects/assemblies? I'm using C# with ASP.NET in a Website project (Note: Not a Web Application).

Obviously there's not a way to enforce this restriction using language-specific OO keywords so I am looking for something else, for example: maybe a permission framework or code access mechanism, maybe something that uses meta data like Attributes. I'm unsure.

I don't really care whether the solution actually hides classes from each other or just makes them inaccessible, etc. A runtime or design time answer will suffice. Looking for something easy to implement otherwise it's not worth the effort ...

Background: I'm working in an ASP.NET Website project and the team has decided not to use separate project assemblies for different software layers. Therefore I'm looking for a way to have, for example, a DataAccess/ folder of which I disallow its classes to access other Types in the ASP.NET Website project.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET