locked
SharePoint Code Access Security Issue RRS feed

  • Question

  • 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
    • Moved by Mike Walsh FIN Tuesday, June 21, 2011 3:01 PM not general (From:SharePoint - General Question and Answers and Discussion (pre-SharePoint 2010))
    Tuesday, June 21, 2011 11:20 AM

Answers

  • 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

    Wednesday, June 22, 2011 9:28 AM

All replies

  • 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

    Wednesday, June 22, 2011 9:28 AM
  • 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.

    Wednesday, June 29, 2011 2:06 AM
  • Thanks Wayne,

    It is helpful, I am working on it.

    Your cooperation is highly appreciated


    Regards, Anas N. Alhussein | Sharepoint Senior Developer
    Sunday, July 17, 2011 6:53 AM