Code based security


Martin Robins

Unfortunately, this is an area of the .NET framework that I have yet to get
a grip of; however, I have a requirement that I believe can be acheived
using code based security.

I would like to create one or more class libraries that can only be used by
an application that is signed with the same strong name key.

The objective is that some of the classes within the library can only be
used by my application.

I am also open to alternative solutions, I have tried the licensing examples
where a class can only be used when licensed but I have never been able to
get the examples working.

Thanks in advance.

Mickey Williams

If you want to restrict access so that it's called by a specific app, you
can make a link demand - it's checked during the jit, and is fairly
low-cost. After the original jit, the check gets out of the way.

Martin Robins


Could you possibly be more specific?

I have tried using StongNameIdentityPermissionAttribute at the assembly
level of the DLL, but by then signing the calling assembly I still get a
permissions error. I suspect that I am close, but still have no cigar!!

Any chance of a small example?


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