Tuesday, March 08, 2005

SharePoint & WSS_Medium

As I mentioned in an earlier post, I've been trying to determine the overhead involved with updating data via SharePoint WebParts vs. ASP.NET WebForms. To get started, I created a simple WebPart to render the request's query params to a HTML table. So, the first problem I ran into is that a WebParts do not have access to the params collection due to CAS. When I exec'd the page, an error regarding "LinkDemand for AspNetHostingPermission failed" (or similar). So, my WebPart didn't have this permission. I added it to GAC, but elevating it to Full trust probably isn't a good idea. Thanks to several blog posts (Debugging Web Parts - a full explanation of the requirements in particular) I changed the system.web/trust config from level='WSS_Minimal' to 'WSS_Medium' This brought my WebPart back to life, and I believe I'm operating in a least required security mode now.

1 comment:

Jay Metaj said...

I've been reviewing some of my old posts. For this post in particular, there is a better solution. Typically what I do now is create a custom trust config (based on min or med) and add the required permissions to it. This works well, for example, for giving sites ConnectAccess of WebPermission only for specific URLs (whereas Full doesn't restrict any). The downside (as is true of Full, etc.) is that it affects all sites config'd by this web.config.