When we deploy application pages to SharePoint, sometimes we need to deploy them to libraries or root instead of “Layouts” folder and may be with some code behind. By default SharePoint will issue above error since it violates its derived Code Access Security principles.
In this case we need to explicitly add the safe control entry to web.config file. There can be following concerns.
- What if there are multiple modules ?
- What if we need to fully automate the deployment process without anyone manually touching config files ?
Luckily, there is a solution provided by Visual Studio itself. We can add a safe control entry to module by following the steps given below.
1. Right click your module and click Properties
2. Select Safe Control Entries and Expand to add one
3. Add new entry and fill content accordingly
4. Deploy the package again
Now the page renders as expected.
No comments:
Post a Comment