locked
webapplication creation modifies all other web.config automatically files RRS feed

  • Question

  • Hi All

    Can anyone shed some light on this issue, as i cannot find anything related in internet.

    I have this moss server where creating new web application modifies all the other website web.config files."Date modified" for all web.config becomes the same date as when i created new web app. Although it does not affect any sites but Forms based Authentication site.

    Particularly FBA site connection string gets overwritten with custom connection string (code below), which brings my fba site down. and updates  <forms loginUrl="/_layouts/ExternalCollaboration/login.aspx" /> where i have specified custom login page. What i am trying to find out is two things:

    a. Where is the default conection string specified? for sharepoint to copy and replace my custom connection string with another custom connection string. This connection string it inserts is a valid local connection string to another live server, which makes me belive that it is specified somewhere.

    b. What trigers the web.config modification?

    fyi - i have checked 12 hive webconfig and custom fetaure but nothing found.

      <connectionStrings>
        <add name="ADAMConnectionString" connectionString="LDAP://mylocaldomain.LOCAL:636/CN=Users,CN=EXTUSERS,DC=mylocaldoamin,DC=LOCAL" />
        <add name="DBConnectionString" connectionString="Data Source=databasename; Database=ECTS; Integrated Security=SSPI" />
      </connectionStrings>

    <membership defaultProvider="ADAMUser">
          <providers>
            <clear />
            <add name="ADAMUser" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ADAMConnectionString" attributeMapUsername="userPrincipalName" requiresQuestionAndAnswer="true" enablePasswordReset="true" attributeMapPasswordQuestion="eatmuPasswordQuestion" attributeMapPasswordAnswer="eatmuPasswordAnswer" attributeMapFailedPasswordAnswerCount="eatmuFPAC" attributeMapFailedPasswordAnswerTime="eatmuFPAT" attributeMapFailedPasswordAnswerLockoutTime="eatmuFPALT" />
          </providers>
        </membership


    Friday, May 11, 2012 2:12 PM

All replies

  • Hi,

    Interestingly I havent found the source yet but you shouold be able to change the behavior fopr your web app.. In the following example I am setting the login.aspx as my custom page. Alsdo, Note I dont think your talking about a connection string but a cutom layout page

    SharePoint 2010 however, offers this functionality out-of-the-box for the following application pages:

    • AccessDenied (/_layouts/AccessDenied.aspx)
    • Confirmation (/_layouts/Confirmation.aspx)
    • Error (/_layouts/Error.aspx)
    • Login (/_layouts/Login.aspx)
    • RequestAccess (/_layouts/ReqAcc.aspx)
    • Signout (/_layouts/SignOut.aspx)
    • WebDeleted (/_layouts/WebDeleted.aspx)

    PowerShell Example for SP2010: Set-SPCustomLayoutsPage -Identity "_layouts/login.aspx" -RelativePath "/_layouts/MyPages/Login.aspx" -WebApplication then iisreset to flush the cache

    You can also use Get-SPCustomLayoutsPage find where your custom layout pages have been mapped. I will dig a little more this eveving but ,may not have time until tomorrow into SP2007 as I have still have old legacy code around...

    The SP2007 feature receiver Example for SP2007 must be WebApp Scoped Feature

    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
        if (properties == null) throw new ArgumentNullException("properties");
     
        SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
     
        if (webApp != null)
        {
            webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Login, "/_layouts/MyPages/Login.aspx";
            webApp.Update();
        }
    }
    
    

    -Ivan


    Ivan Sanders My LinkedIn Profile, My Blog, @iasanders.


    Sunday, May 13, 2012 4:53 AM
  • HI Ivan

    thanks for looking into this - however thing i want to find out is why my web.config file is getting modified, what triggers this modifiaction and what decides to set this value. I have searched under C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\CONFIG - nothing i can find which says modify this 3 values in web.config.

    1. form login page

    2. membership tags

    3. custom connection string.

    this only happens on new webapplication creation

    Monday, May 14, 2012 11:19 AM
  • This has also happened in my environment.  We have very little customization to the web.config.  In the <AppSettings> node of the web.config, we have our a key/value pair with our 2010 SP Server Names that is used by a custom navigation control.  When the web.config is replaced, the 2010 Server Names are replaced with the 2007 server names.  Below are important dates and events.  Any help would be greatly appreciated!  **Note: this happened at multiple companies I've worked for for SP 2007 and 2010.

    6/17/2012 - Migrated to SP Server 2010 from MOSS 2007

    11/9/2012 - Web.config replaces itself with an older version.  I manually copied an older (correct) version of the web.config over the web.config for each server in the farm.  My team could not discover a cause for this.

    1/10/2013 - Web.config replaces itself with an older version. I also discovered that a new developer created a new Web Application at the exact time the web.config was replaced.  I could tell by the time stamp on the new Web App's folder in the INETPUB.

    Why is this happened?  Where is it pulling the old web.config from?  The servers were decommissioned months ago.  The values aren't cached because the servers have been rebooted multiple times.  Are these AppSettings values stored in the SharePoint Config DB?

    Thanks

    Thursday, January 10, 2013 6:41 PM
  • Hi All,

    A possible scenario is if the SPWebConfigModification class has been used to modify web.config settings as part of a Feature Receiver. The SPWebConfigModification class of the Microsoft.SharePoint.Administration namespace, 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. The changes become effective when the SPWebService.ApplyWebConfigModifications method is called.

    However, if it is not implemented properly you can end up modifying multiple WebApps, reverting to an older WebConfig etc.. I have had issues where when learning how to use the class properly I modified every WebConfig for every webApp every time I tested the Feature Receiver on any WebApp. There are a lot of gothchas but it is the correct way to go when deploying Features that require WebConfig modifications...

    -Ivan


    Ivan Sanders My LinkedIn Profile, My Blog, @iasanders.

    Friday, January 11, 2013 11:36 PM