Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 2.0 Security, Membership, and Role Management ISBN: 978-0-7645-9698-8
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Security, Membership, and Role Management by Stefan Schackow; ISBN: 9780764596988
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 Security, Membership, and Role Management ISBN: 978-0-7645-9698-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2008, 08:22 AM
Registered User
 
Join Date: Aug 2008
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default running Win32 dll in medium trust

Hi,

i have a problem with a particular win32 dll which has a .net assembly correctly interfacing with the win32 dll. These are located in ./bin directory of asp website. Using .net 2.x.

In full trust mode this works fine but in medium trust the compiler complains that it can't locate one or more its components.

The question is where should the win32 dll be located? or is there a way of providing the location of dependencies during configuration of trust? i couldn't see any reference to this question?

Many thanks.






 
Old October 31st, 2008, 01:26 PM
Wrox Author
 
Join Date: Feb 2006
Location: Redmond, Washington, USA.
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Managed code calling into a native DLL requires unmanaged code permission. When an ASP.NET application runs in partial trust, all code in the /bin directory runs in a more restricted trust level which does not include unmanaged code permission. As a result when the managed code attempts to load the Win32 .dll, the load fails because the managed code doesn't have rights to interact with native code.

To fix this the managed code would need to be installed in the GAC, since all assemblies in the GAC are trusted, and hence are allowed to call native code even in partial trust environments. However installing the managed code in the GAC will also require that the managed assembly be APTCA attributed so that partial-trust user code in the ASP.NET application can call into the managed library.

-Stefan




Similar Threads
Thread Thread Starter Forum Replies Last Post
Membership not working in Medium Trust stoverje BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 July 5th, 2008 10:43 AM
Medium trust problems DavidWilks BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 June 26th, 2007 03:51 PM
Medium Trust mike_h BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 6 October 24th, 2006 05:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.