Visit our SharePoint Forum

SharePoint developer? Submit Yourself as Freelancer

Tuesday, August 19, 2008

Increasing trust level for a single WebPart in WebConfig File

To list a Web Part with Full Permissions within your Web Application while still retaining a WSS_Minimal permission set for all other Web Parts follow these steps:

1. Make a copy of the WSS_Minimal.Config file from the 12\Config folder and paste it into the same folder renaming it to Custom_WSS_Minimal.Config.
2. Edit the Custom_WSS_Minimal.Config file with an XML editor such as Visual Studio.NET or NotePad.
3. Obtain the Public Key Token and Public Key Blob for the Web Part assembly that you want to deploy using the following command: sn –Tp filename.dll.
4. Create a new entry in your Custom_WSS_Minimal.Config file for your WebPart.
5. Create a new TrustLevel element for your config file in the Web.Config called Custom_WSS_Minimal that points to your custom file in the 12\config folder.
6. Set the Trust Level of the Web.Config to Custom_WSS_Minimal
7. Recycle the Application Pool or run IISReset
8. Deploy & Test your Web Part.


Reference : http://www.combined-knowledge.com/Downloads/Code%20Access%20Security%20in%20SharePoint%202007%20for%20Administrators.pdf

2 comments:

kancharla said...

Hi i have a probny one please help me to solve that

I have two master pages for my portal i need to apply master page1 to Administrator and master page2 to other users. How can i do that

Thanx in Advance

isha kapoor said...

add a usercontrol in ur master pages or to just one master page which will deduct the group of current user logged in and chnage the master page .. there is a command to switch master page on fly .... please find from blogs!

You can also write code to switch CSS files (if u have for master page)

SharePoint Programming