Debuging Attributes in c#

  • Thread starter Thread starter James Bolles
  • Start date Start date
J

James Bolles

I have visual studio and I am trying to create a
Attribute permission that is enforced when the method is
called. However, it is never being fired. I have
compiled the attribute cs in release mode, placed the dll
in the gac, and registered the dll with the caspol.
Still, it does not work.

Is there anyway to write codeaccesssecurity permission
and debug them? Can you disable the security all
together to debug the application first?

Thanks,
James
 
Hello James,

As I understand, you create a custom code access permission and make
declarative demands for your custom permission. And now you cannot debug
the methods which are enforced by the custom permission. Please correct me
if there is any misunderstanding. I'd like to share the following
information with you:

As you know, default security policy does not know about the existence of
any custom permission. You have to update security policy to make it know
your custom permission. After that, we can grant FullTrust to either the
share or the individual assemblies. Please refer to the following articles
and resources:

Updating Security Policy
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconupdatingsecuritypolicy.asp

<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/ht
ml/cpconsecuritypolicybestpractices.asp> for .NET framework security best
practices. It has several good links.

How to trust a specific share:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/ht
ml/vxurfprojectfoldernotsecuredialogbox.asp

<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/ht
ml/cpgrfcodeaccesssecuritypolicyutilitycaspolexe.asp?frame=true> has a
really good description for the Caspol command line syntax.

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
 
Thanks for the response, HuangTM. It turns out the way I was trying to
register my custom permission into the caspol was incorrect. I was
doing caspol -af assemblyname.dll but that we was not enough. I ended
up using the caspol wizard and telling it I wanted it installed on the
local machine as a fully trusted assembly and it works.

However, do you know of a way to debug code when you have problems like
this? I was unaware if you could have an item in the GAC and allow it
to be debugged.

Thanks for you time.
James
 
Back
Top