Hi,
I am having some code in the feature activated event to update the web.config using SPWebConfig Modification class.
When i call the update method i am getting access denied error.
I followed option 4 in the below mentioned blog.
http://www.firozozman.com/post/5-ways-to-update-Sharepoint-WebConfig-file.aspx
The sample code is taken from http://www.mtelligent.com/display/ShowJournal?moduleId=489404&categoryId=135738
but the only difference is i am doing it in SharePoint 2010.
I have a question in option 2 in the same blog
http://www.firozozman.com/post/5-ways-to-update-Sharepoint-WebConfig-file.aspx
suggestion provided in the blog for option 2:
Well, it seems nice and clean until you realize that, in Sharepoint this works only during the creation of a WebApplication. In SharePoint, when a new Web <a href="http://www.firozozman.com/post/5-ways-to-update-Sharepoint-WebConfig-file.aspx#" id="_GPLITA_3" style="text-decoration:underline;" title="Click to Continue > by CouponDropDown">Application is created using Central Admin (or admin script), SharePoint, takes a copy of web.config file from its 12 hive CONFIG folder. During this operation, if it finds an extension xml file, the configuration entries will be processed and web.config file will be updated accordingly. Once the Web Application is created any changes you make to this extension file will never be reflected on to web.config until you recreate (you, crazy) the web application
So if i am not wrong it modifies the web.config file while creating the web app alone and it will do it for all web apps inside the FARM.
I want to update it only inside my web app web.config file.I have checked with few folks and they are saying that if you update web.config file inside C:\inetpub\wwwroot\wss\virtualdirectories\MyWeApp\web.config then if any service pack is upgraded then the entire changes will be lost.
Please correct me if am wrong with my understanding.To me option4 looks like best approach.I have followed that but i am getting access denied error.
I am executing the code with FARM Admin account.
My App pool is running in FARM Admin account.
My FARM Admin account have full permissions to C:\inetpub\wwwroot\wss\virtualdirectories\\MyWeApp\web.config
Thanks, Vijay Arockiasamy