Modifying WebConfig File programmatically

This article describes how to modyfy the webconfig file of a SharePoint site

Introduction

While working in SharePoint, I know the difficulties a developer face due to security issues. Here is a simple example how to modify your SharePoint web config file programmatically.

Background

If you are using some external DLL ( third party DLLs) then you may need to modify the "trust level" from wss_minimal to full. In that case you may want to do it programmatically insted of doing this manually.

Here is the code spinet for achieving this task.

Using the code

First of all I am doing all these things in feature activate of the feature.

Comments and Discussions

Seriously, this is one of the single worst ideas ever. I manage development on a large enterprise installation for the government. If you as a developer don't have access to the server, and you shouldn't unless it is a development server, you as the developer should never override built in protections.

If any of my developers suggest anything like this they will be out of a job before they get done explaining it. If I find one of my contract companies trying anything like this, they'd lose their rating to work with the government.

By the way, if you are a developer working on a developer server, you should learn to do things the proper way so you have an understanding of the deployment documentation your IT staff will use to deploy your solution the PROPER WAY.