Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Limit component/assembly to use only Medium Trust compatible classes

Thread Tools

Limit component/assembly to use only Medium Trust compatible classes

Posts: n/a
I am developing a custom .NET component that will be used from both
desktop apps (WPF, WinForms) and from ASP.NET. I want to make sure
that component will work in ASP.NET Medium Trust.
How to set assembly-level security permission so it throws an error if
ANY of used classes in an assembly requires more than Medium Trust?
Ideally we want to set something in AssemblyInfo.cs or project
settings that will cause compiler to report "Class XY is not
compatible with Medium Trust".
Before you answer note few things:
1) Since our DLL is NOT an web application, we canít set web.config
file to " <trustLevel name="Medium".."
2) Having a unit test that is a web application configured for Medium
Trust is not satisfactory because it will throw an exception ONLY if
problematic code is executed. We made that mistake on previous
project; we realized it is not compatible with Medium Trust only when
somebody clicked on advanced option!
3) Something like "[assembly: PermissionSetAttribute
(SecurityAction.PermitOnly, Name="MediumTrust")]" is not possible
because SecurityAction.PermitOnly canít be used on assembly.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 1.1 app breaks when moved to shared webhosting with medium trust level Andy ASP .Net 1 12-21-2006 05:40 PM
Full trust and medium trust in .net and websites Linda ASP .Net Security 1 08-31-2006 05:16 AM
Does GridView.DataBind work under medium trust with custom objects =?Utf-8?B?TWFyayBMZWlzdG5lcg==?= ASP .Net 3 08-22-2006 11:13 PM
Does WSE 2.0 work with Medium trust or stronger? Michael Howes ASP .Net 0 01-26-2006 12:16 AM
Medium Level Trust and Reflection Paul Hatcher ASP .Net 0 02-25-2005 02:12 PM