I would like to build something in C# to edit the web.config of the web application.
I would like to enable the blob cache for the image renditions.
What is the best practice to edit the web.config Programmatically?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityYou can modify web.config settings is to use the SPWebConfigModification class of the Microsoft.SharePoint.Administration namespace, which allows you to dynamically register entities. These modifications are persisted in the configuration database where they function as a kind of virtual web.config that effectively serves as the final layer of the .config file stack for the SharePoint Foundation web application.
How to: Add and Remove Web.config Settings Programmatically
To enable Blob Cahce, please check this:
You can read the following for general guidelines around Blob configuration for media in sharepoint
This is pretty generic, but is a worthwhile read : Security Best Practices