Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 31st, 2008, 09: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.






Reply With Quote
  #2 (permalink)  
Old October 31st, 2008, 02: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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 11: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 04: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 06:52 PM



All times are GMT -4. The time now is 11:53 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.