SharePoint Code Access Security Issue
Dears,
We have a portal running fine and we want to apply Code Access Security by defining custom policy file. Currently we use the full trust level.
We started by uninstalling our custom webparts.dll from gac (full trsted) and putting it in our portal bin folder in IIS. And then changing the trust level in our portal web.config to "ourCustomPolicyFile" which is copied from "WSS_Medium". Finally we
restarted the IIS and when browsing the portal a security exception thrown:
[SecurityException: Request failed.]
Microsoft.SharePoint.Publishing.PublishingLayoutPage..ctor() +39
CMA.Internet.WebParts.HomePageWithTabs..ctor() +41
This is because we used a class inherited from "Microsoft.SharePoint.Publishing.PublishingLayoutPage". And based on the middle of the page
http://msdn.microsoft.com/en-us/library/ee909485%28v=office.12%29.aspx this class should be fully trusted accessed
So how can I modify my custom policy file to fix this exception.
Note: Microsoft.SharePoint.Publishing.dll is located in the GAC
Thanks,
Regards, Anas N. Alhussein | Sharepoint Senior Developer
June 21st, 2011 2:20pm
Hi Anas,
Thanks for your post.
If you want to use the
Microsoft.SharePoint.Publishing.PublishingLayoutPage class in your project, you must set the trust level to “Full”. Or you have to deploy the web part assembly to GAC.
From the SDK documentation, the PublishingLayoutPage class requires full trust. This means that the assembly containing this class must be deployed to
the global assembly cache or must be fully trusted.
http://msdn.microsoft.com/en-us/library/ee909485%28v=office.12%29.aspx
Thanks,
Wayne
TechNet Subscriber Support
in forum
If you have any feedback on our support, please contact
tngfb@microsoft.com
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2011 12:28pm
Hi Anas,
Would you please let us know how is your problem going? Is the suggestion helpful for your issue?
If you need further assistance, please feel free to let us know.
Thanks,
Wayne Fan
TechNet Subscriber Support
in forum
If you have any feedback on our support, please contact
tnmff@microsoft.com.
June 29th, 2011 5:06am
Thanks Wayne,
It is helpful, I am working on it.
Your cooperation is highly appreciatedRegards, Anas N. Alhussein | Sharepoint Senior Developer
Free Windows Admin Tool Kit Click here and download it now
July 17th, 2011 2:55am


