Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6233325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:16:45+00:00 2026-05-24T10:16:45+00:00

Within an web.config -file in an ASP.NET-application some sections of config, like appSettings and

  • 0

Within an web.config-file in an ASP.NET-application some sections of config, like appSettings and connectionStrings, supports the attributes file and configSource.

What is the difference between using the file-attribute and the configSource-attribute? When should you use which attribute and can you use both?

<?xml version="1.0"?>
<configuration>
  <appSettings file="AppSettings.config">
  </appSettings>
  <connectionStrings configSource="ConnectionStrings.config">      
  </connectionStrings>
  <!-- ... -->
</configuration>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:16:46+00:00Added an answer on May 24, 2026 at 10:16 am

    file attribute

    • Specifies a relative path to an external file that contains custom application configuration settings
    • specific to the appSettings section
    • will merge (and override) settings in the .config file
    • will not cause web application to restart when modifying the specified file
    • http://msdn.microsoft.com/en-US/library/ms228154(v=vs.100).aspx
    • Using the Configuration.AppSettings.Settings.Add API will result in all settings being merged back into the main .config on a Configuration.Save call.
    • since .NET 1.1
    • Exception is not thrown if file does not exist.

    configSource attribute

    • can apply to most sections of a configuration file, not just appSettings
    • will override the entire section with the external file, no merging
    • CAN cause web application to restart
    • http://msdn.microsoft.com/en-US/library/system.configuration.sectioninformation.configsource(v=vs.100).aspx
    • Using the Configuration.AppSettings.Settings.Add API will result in all settings being added to the file specified in configSource on a Configuration.Save call.
    • since .NET 2.0
    • System.Configuration.ConfigurationErrorsException is thrown if config source file does not exist.

    The file attribute specifies an external file containing custom settings like you do in the appSettings entry of the web.config file.
    Meanwhile, the external file specified in the configSource attribute contains the settings for the section which you declare the configSource for. For example, if you use the configSource attribute of the pages section, then the external file will contain the settings for the pages section.

    The custom settings declared in the external config specified in the
    file attribute will be merged with the settings in the appSettings
    section in the web.config file. In the meanwhile, the configSource
    does not support merging, it means that you’ll have to move the entire
    section settings into the external file.

    http://www.codeproject.com/Messages/1463547/Re-difference-between-configSource-and-file-attrib.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am hosting a WCF Service within an ASP.NET MVC web application. I would
Using ASP.NET under .NET 2.0, is it possible to get/set AppSettings in a web.config
In my ASP.NET's Web Config file I have the following location elements defined: <location
Is there an easy way to read settings from a (asp.net) web.config file using
I have a small ASP.NET web application hosted in an integration test (executing within
I am currently trying to configure an ASP.net Web Application through Web.config, to host
I have an ASP.NET MVC 3 application. I need to implement a file uploader
I am working on a asp.net web application that has is a part of
I have an ASP.NET application. It resides within another ASP.NET application. I put my
I have an application consisting of an ASP.NET web application, a couple of Windows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.