Configuration Error what is this

Last post 09-07-2009 5:48 AM by Thomas Sun – MSFT. 3 replies.

Sort Posts:

  • Configuration Error what is this

    09-02-2009, 2:46 AM
    • Member
      1 point Member
    • a.a.stephen
    • Member since 08-13-2009, 2:22 AM
    • Posts 14

    when i publish iam geting this error why before i add this tag in the web config i am able to pulish but now i cant am addging master page dynamically here

    this is the error


    Configuration Error

    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: The entry 'MasterPageFile' has already been added.

    Source Error:

    Line 34:     <profile>
    Line 35:       <properties>
    Line 36:         <add
    Line 37:         name="MasterPageFile"
    Line 38:         defaultValue="Nurse.master" />

    Best Regards
    Stephen
  • Re: Configuration Error what is this

    09-02-2009, 4:52 AM
    • All-Star
      22,266 point All-Star
    • vik20000in
    • Member since 12-30-2005, 6:02 AM
    • Kolkata
    • Posts 3,464
    • TrustedFriends-MVPs

    Is it because the  MasterPageFile property is already added to the Prfile property. Chekc if this profile property already exists in config

    Vikram
    www.vikramlakhotia.com


    Please mark the answer if it helped you
  • Re: Configuration Error what is this

    09-02-2009, 5:40 AM
    • Member
      1 point Member
    • a.a.stephen
    • Member since 08-13-2009, 2:22 AM
    • Posts 14

    no only this is there


    when i remove the <clear/> only this error coming if i not remove the clear this error is coming when i run from VS after removing <clear/> also is working fine in the VS but when i put tht in to the localhost is not woking but with the <clear/> tag is working in the local host why is that

    The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty. (C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config line 146)


    this is my web.config file

    configuration>
        <configSections>
            <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
            <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                        <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
                        <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                        <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                        <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                    </sectionGroup>
                </sectionGroup>
            </sectionGroup>
        </configSections>
        <appSettings/>
        <connectionStrings>
        <clear/>
            <add name="ConString" connectionString="Data Source=STEPHEN-PC\SQLEXPRESS;initial catalog=MY;User Id=sa;Password=***" providerName="System.Data.SqlClient"/>
        </connectionStrings>
        <dataConfiguration defaultDatabase="ConString">
        </dataConfiguration>
        <system.web>

        <profile>
          <properties>
            <add name="MasterPageFile"/>
          </properties>
        </profile>

        
            <!--
                Set compilation debug="true" to insert debugging
                symbols into the compiled page. Because this
                affects performance, set this value to true only
                during development.
            -->


    am using this profile in here


    protected void Page_preInit(object sender, EventArgs e)
        {


            if (Request["master"] != null)
            {
                switch (Request["master"])
                {
                    case "phar":
                        Profile.MasterPageFile = "PharmacyStaff.master";
                        break;
                    case "nurse":
                        Profile.MasterPageFile = "Nurse.master";
                        break;

                }
            }
            MasterPageFile = Profile.MasterPageFile;

        }

    if i put the <clear/> tag in that place  that LocaSqlError is coming that is pointing on the Profile.MasterPageFile


    why is this please help me

    thank you

    Best Regards
    Stephen
  • Re: Configuration Error what is this

    09-07-2009, 5:48 AM
    Answer

     Hi,

    By default, ASP.NET profile uses connection string named 'LocalSqlServer'. And it is in the machine.config, which is the root config file and all ASP.NET website's web.configs inherit it. So if you use <clear/> tag to clear it, you ASP.NET cannot find it and will throw the exception.

    If you want to save profile data in another database, you can modify the 'LocalSqlServer' to point to you new database. For more information, see http://www.odetocode.com/articles/440.aspx

     

    Thanks.

     

    Thomas Sun
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
Page 1 of 1 (4 items)