Deploying custom Asp.net applications to same IIS site as Sharepoint

Securitysharepoint

I am attempting to setup an Asp.net application on the same site as Sharepoint. So where http://sharepointurl is the url for sharepoint, to access the application the url would be http://sharepointurl/MyCustomWebApp/. I have setup an IIS application at this level but attempting to run the application with a custom dll in the bin results in the error

" Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed."

I attempted to sign the dll and register it with the sharepoint servers GAC but then I received:

"System.Security.SecurityException: That assembly does not allow partially trusted callers."

If I remove the DLL from the applications bin directory the page loads but I lose functionality I need within it.

Edit: The error happens only if the Dll is in the bin, it does not depend on any one line of code in the Dll.

IIS Version 6
Sharepoint: WSS 3.0
Windows Server 2003

Update: I ran "caspol -machine -addfulltrust (path to dll)" and it succeeded but I still receive the same error.

Best Answer

I finally got this resolved. I think part of it was solved by a mix of trying different things people have suggested, but ultimately what fixed it was adding "<trust level="Full" originUrl=""/>" into the web.config. For anyone that doesn't know it should go under the system.web section. I also needed to add several of the dll's. Adding the dll's to the GAC helped but did not solve all of the issues.

Related Topic