What should you do?

You create a Visual Web Part in SharePoint Server 2010.

You need to ensure that the Web Part can access the local file system on the SharePoint server. You must minimize the amount of privileges assigned to the Web Part.

What should you do?

You create a Visual Web Part in SharePoint Server 2010.

You need to ensure that the Web Part can access the local file system on the SharePoint server. You must minimize the amount of privileges assigned to the Web Part.

What should you do?

A.
Elevate the trust level to Full.

B.
Elevate the trust level to WSS_Medium.

C.
Create a custom code access security (CAS) policy.

D.
Deploy the Web Part to the Global Assembly Cache (GAC).

Explanation:
MNEMONIC RULE: “access the local file system = custom code access”

WSS_Medium will give you access to System.Security.Permissions.FileIOPermission, but it’ll also give you access to a few other assemblies/namespaces.
If the goal is to minimize the amount of privileges, then CAS is the way to go.

Securing Web Parts in SharePoint Foundation
http://msdn.microsoft.com/en-us/library/cc768613.aspx



Leave a Reply 0

Your email address will not be published. Required fields are marked *