I have read around what other bloggers wrote about custom web parts, and found that most say to copy the dll file to the _app_bin directory, in spite of what the SDK says-"Web Parts cannot be stored in the _app_bin directory."
I could not find a difference between the two folders. Putting a web part in either one seems to work just as well.
However, there is one thing to note from the SDK - both folders have by default low trust levels. A simple web part will work, but when you try to use sharepoint object you get the dreaded sharepoint.security error that throws your users to the maintnance page. yuck!
To make sure this doesnt happen, either put the dll in the GAC (requires signing) or follow the directions from the SDK to allow web parts in the bin directory to run with trust:
Step 3: (Optional) If using the bin directory, set special security attributes
By default, code access security permissions for the bin directory are low; only pure execution is allowed. Although the sample in this walkthrough can run with the minimal trust level, in most cases you need to elevate these permissions to make your assembly run correctly, for example, if your Web Part requires access to the SharePoint object model.
There are two ways to elevate permissions:
Microsoft Windows SharePoint Services and Code Access Security.
To raise the trust level of the bin directory
Locate the web.config file in your application root and open it for editing.
Locate the trust level tag,
No comments:
Post a Comment