Does anyone have experience with code access security?

R

Ramzey

I've looked through the MSDN documentation on code access security and
can not seem to find an answer to my question.

I have a class XYZCorpWebPage that uses System.Web.UI.Page as it's
base class. I want to make it so that the web server will throw an
exception/deny runtime rights to any WebForm derived from
System.Web.UI.Page, but I want to allow runtime rights on
XYZCorpWebPage (I want to force our developers to use XYZCorpWebPage
as their base class).

Can this be done using the .NET Configuration Wizards? I only see
access to increase trust in an Assembly and I'm not sure how it will
resolve the conflict.
 
N

Nicholas Paldino [.NET/C# MVP]

Ramzey,

You can't do it. The reason for this is that you would have to be able
to modify System.Web.UI.Page to modify the permissions it demands. You
don't have access to this, so you can't change it.

What I would do is create a class that implements IHttpHandler that will
then create the appropriate class and check to make sure that it derives
from your type.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top