I copied an ASP.NET application DLL into \Inetpub\wwwroot\bin and copied the application folder under Sharepoint 2007 TEMPLATES\Layouts folder, so I could access the application from http://sp-portal/sites/sitecoll123/_layouts/aspnetapp/Default.aspx
. It complained that:
Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
I then installed the DLL to the GAC (after removing it from the \inetpub\wwwroot\bin folder) and it could not load the DLL. It complained that:
Could not load type 'AppNS.Default'. at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)
Then, I copied back the DLL into \Inetpub\wwwroot\bin, while still leaving the assembly installed in the GAC as well. Only then it worked! I cannot explain this... I thought having it in the GAC is the quick and dirty way of getting the assembly to be accessible easily. Why does it need to be in both places? This is an ASP.NET 3.5 application installed under _layouts in Sharepoint/MOSS 2007.