views:

1388

answers:

3

Hi!

Using the SharePoint API, how can I modify an extended webapp web.config file?

I have to do some changes in this file to specify the connection string, membershipprovider, etc... for using Forms Authentication.

Currently, I can change the "master" webapplication web.config file, but not the extended one.

Edited

I'm using Sp 2007. I'm already using SPWebConfigModification class to modify the parent webapp. Thoses modifications are propagated to the extended webapp. I have to change ONLY the extended one. But I don't find the way to do it.

What I'm trying to achieve, is to program a little wizard that:

  • Shows a WebApp list so the user can select one
  • Extend that selected webapp to a different zone
  • Configure that extended zone to use Forms Authentication

Thanks

A: 

Quick answer: look into the SPWebConfigModification class. I am assuming you're using SharePoint 2007. The best way to learn about this is to dig into open source projects:

Google code search: http://www.google.com/codesearch?q=spwebconfigmodification&hl=en&btnG=Search+Code This project on CodePlex looks like it's one big SPWebConfigModification: http://www.codeplex.com/ajaxifymoss/Release/ProjectReleases.aspx?ReleaseId=13360

Peter Seale
According the SPWebConfigModification class, I'm already using it. I'm able to modify the "parent" webapp, but not the extended one.
vIceBerg
+1  A: 

I got an answer form a blog.

In your case , you need to write a Web Application scoped feature which after you provision your site using your C# app, it is deployed to the newly-provisioned site and in the receiver of the feature you inject the required web.config settings because in that context configuration API is obtainable , but again bear the following in mind:

If you don’t use SPWebConfigModification class and either use ASP.NET 2.0 configuration API or your own mechanism , propagating changes across the farm is YOUR RESPONSIBILITY. If this happens on an standalone installation then you don;t need to be worried about this.

So it cannot be done externally. We have to do a feature in order to acheve this.

Thanks

vIceBerg
A: 

But does the SPWebConfigModification actually modify the web app's web.config or the extended web app's web.config?

Also, what if I need to make changes to /_trust/web.config? How do I specify that?

Thanks