Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2006

Tip: Looking for answers? Try searching our database.

Code Access Security Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff - 24 Oct 2006 15:48 GMT
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
Bryan Phillips - 26 Oct 2006 03:13 GMT
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

> 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
[quoted text clipped - 13 lines]
>
> Jeff

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.