PortalSiteMapprovider Code Access Security Requirements

599 views Asked by At

I'm using a portalsitemapprovider object to create my navigation server control.

I've assigned sharepoint object model access and impersonation rights in the controls CAS. However despite this I can't retrieve the child nodes of the root node of the sitemap, they just return an error.

If I change the web app to run under full trust I can retrive the child nodes.

Thus my question is what CAS policies are requried to fully access data in the sitemap provider object, and how come I can access the root node but not it's children currently?

Example code:

PortalSiteMapProvider sp = PortalSiteMapProvider.WebSiteMapProvider;
PortalSiteMapNode rootNode = (PortalSiteMapNode)siteProvider.RootNode;
foreach (SiteMapNode node in rootNode.ChildNodes)
{
    //this loop returns 1 item with title "Error" with no exception thrown. 
}

My Assembly has the following CAS requests:

[assembly: SharePointermission(SecurityAction.RequestMinimum, ObjectModel=true, Impersonate=true)]

With approprite IPermission entries in the deployment manifest. After deploying the web app web.config is updated to WSS_Custom trust level as expected.

Any ideas?

Thanks

1

There are 1 answers

4
Alex Angas On

You could try using Reflector. This should show you the CAS permissions on that class.

Or use WSPBuilder, which will use reflection to generate the CAS file for you. I recommend this option as you shouldn't need to worry about editing your CAS files again!