|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Code Access Security QuestionI have a component dll that lives in the GAC. One of the classes in the
component dll calls unmanaged code. I use the component dll from an ASP.NET application that I'm trying to get to run under medium trust. My call looks like this: ASP.NET Application ---> Component in GAC ---> Unmanaged code. when my component in the GAC calls the unmanaged code, .NET throws a security exception. I was under the impression that all code in the GAC runs under full trust? In order to get this to work without changing the ASP.NET app back to full trust, I have to explicitly Assert the unmanaged code permission in my component. Is there an implicit LinkDemand requirement on all calls to unmanaged code or something like that? Thanks in advance for any help, Jeff The Assert command is what you really needed to do. When you call
Assert, it stops the CLR from walking farther up the call stack looking at each method and determining permissions. The additional bonus is that stopping the call stack walk will boost performance. Though the DLL's in the GAC run under full trust, the call stack was walked backwards into your ASP.Net code which does not have the correct permissions to call unmanaged code. Bryan Phillips MCSD, MCDBA, MCSE Blog: http://bphillips76.spaces.live.com Show quote "Jeff" <J***@discussions.microsoft.com> wrote in message news:63F4B7BE-A93A-4ACB-A859-365A22936CDD@microsoft.com: > I have a component dll that lives in the GAC. One of the classes in the > component dll calls unmanaged code. I use the component dll from an ASP.NET > application that I'm trying to get to run under medium trust. My call looks > like this: > > ASP.NET Application ---> Component in GAC ---> Unmanaged code. > > when my component in the GAC calls the unmanaged code, .NET throws a > security exception. I was under the impression that all code in the GAC runs > under full trust? In order to get this to work without changing the ASP.NET > app back to full trust, I have to explicitly Assert the unmanaged code > permission in my component. Is there an implicit LinkDemand requirement on > all calls to unmanaged code or something like that? > > Thanks in advance for any help, > > Jeff |
|||||||||||||||||||||||