How to deploy web.config changes in a Sharepoint web application?

I have a website in Sharepoint 2007. We use wsp to deploy our projects. We can deploy dll, usercontrols, functions, but I do not know how to include newlines in web.config.

What is the possible way to make changes to web.config?

Another thing is how to include resources (resx) in wsp?

+4
source share
6 answers

Manually editing web.config in a multi-server farm is a bad idea. Keeping web.config files synchronized on every WFE will quickly become a nightmare.

Using the SPWebConfigModification class to manage web.config changes in the farm is a good idea, because the changes will be saved in the SharePoint configuration database and automatically redirected to each server in the farm.

Having said that coding against a class can be a pain. Fortunately, there is a good external interface that is freely available, giving you a configuration screen in the Central Administration for adding / removing changes to web.config.

+7
source

There is a very simple way to add secure controls through Solution. The following snippet, added to the manifest.xml file, will make the appropriate changes to the web.config file. To set other values, you must do this in the function receiver using the SPWebConfigModification class.

<Assemblies> <Assembly ...> <SafeControl Namespace=".." Assembly="..." Type="..." Safe="True" /> </Assembly> .... </Assemblies> 
+2
source

In addition, if you are thinking of using appSettings from web.config for your site’s configuration values, you have other options. For various reasons, web.config may not always be the best place to post your values ​​- at least if the "superuser", etc., is supposed to be able to change them later. Instead, you can use the Config Store function, which also scales in the farm for multiple front-end servers, etc.:

http://www.sharepointnutsandbolts.com/2008/05/introducing-sharepoint-config-store-for.html

+1
source

Regarding web.config files ...

Web.config is an XML document containing configuration options for a web application. It is located in the root directory of the web application, so for SharePoint it is usually located in the folder C: \ Inetpub \ wwwroot \ wss \ VirtualDirectories \ SharePoint80, where SharePoint80 is the name of your web application.

Manually making changes to the web.config file is safe if you save the tags and sections in the correct order. Check out this article .

It is also possible to make changes to it programmatically, this post should show you how.

Hope this helps.

0
source

I think that the direct manipulation of web.config can be complicated when you have multiple servers. If your entire installation runs on only a few servers, this might be easier than trying to make simple changes to web.config with code.

In addition, manipulating web.config directly ensures that you have full web.config in your version control system. If you use the API to make changes, all you have in the original control is a bunch of C # code, which you hope is error free!

0
source

My advice is not to get confused with any modifications manually using code. Instead, make the "SharePoint path" by placing the modifications in the 12 \ Config directory as described in the Microsoft SharePoint documentation .

0
source

All Articles