Friday, April 24, 2009

Create Custom Policy File for SharePoint WebPart

Now you can run your code without modify FULL trust in WEB.Config file.
Below Steps to create Custom Policy File for WebPart.
  • Copy WSS_Minimal.config fole from ...\12\Config\ folder.
  • Rename to MyCustom_minimal.config.
  • Now Add below Code to this config file as per given location.

Add below code

Code Start Here Code End Here
  • Now Create Your PublicKey's Blob file as per below.
  • Open VS's command Promt and RUN below Command

sn -p YourStongNameFile.snk PublicKeyOnly.snk

YourStrongNameFile.snk = Your Projects SNK
PublicKeyOnly.snk = New creted PublicKey

Now Create Blob as below command.

sn -tp PublicKeyOnly.snk

Now your PublicKey's BLOB created like below (here Example)

Copy New Blob and past in above config file.

  • Put your config file in ...\12\Config\ folder.
  • Add one tag in config file below WSS_Medium,WSS_Minimal trust level like below.

    Also change Trust Level WSS_Minimal to MyCustom_Minimal.

No comments:

Post a Comment