Application Configuration File?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kathy

    #1

    Application Configuration File?

    What Application Configuration File is? And
    when/where/how to use it? Any documents on that? MSDN has
    somrthings scatter everywhere - hard to follow.

    thanks,

  • Jay B. Harlow [MVP - Outlook]

    #2
    Re: Application Configuration File?

    Kathy,
    An Application Configuration File is an XML file that .NET uses to configure
    your application.

    For ASP.NET applications the file is called web.config. At run time it is
    still called web.config.

    For Windows applications, the file is called app.config. At run time the
    app.config is called myexe.exe.confi g and need to be in the same directory
    as the exe itself.

    Class libraries (.dll files) do not have an Application Configuration File,
    they need to rely on either the web.config or the app.config.

    When you use 'Project - Add New Item - Application Configuration File' in
    VS.NET to add one to your project it will be named either app.config or
    web.config per above. At runtime it will be moved to the appropriate folder
    and used.

    There is also a machine.config file, that .NET uses to configure your
    application. This file is merged with the app.config with the app.config
    getting precedence. In other words you can use the machine.config to have
    global settings that are shared across apps, then use the app.config to
    override some of these settings.

    The two primary sections of the app.config are configSections and
    appSettings. appSettings is a predefined section that allows you to define
    name/value pairs. You use
    System.Configur ation.Configura tionSettings.Ap pSettings to read values from
    the appSettings section.

    configSections allows you to define your own sections. You use
    System.Configur ation.Configura tionSettings.Ge tConfig to retrieve these
    values.

    See the following for create new sections via the configSections section.

    http://msdn.microsoft.com/library/de...onhandlers.asp

    and:
    http://msdn.microsoft.com/library/de...ionsschema.asp

    Also read about the System.Configur ation.Configura tionSettings class and
    other classes in the System.Configur ation namespace.

    And yes, the documentation is scattered & hard to follow...

    Hope this helps
    Jay

    "kathy" <kathy@nospam.c om> wrote in message
    news:00aa01c367 fc$0c7b1bc0$a30 1280a@phx.gbl.. .[color=blue]
    > What Application Configuration File is? And
    > when/where/how to use it? Any documents on that? MSDN has
    > somrthings scatter everywhere - hard to follow.
    >
    > thanks,
    >[/color]


    Comment

    • Sanjay Tibrewal

      #3
      Re: Application Configuration File?

      The intent was not to offend you which you seem to have been so my
      apologies.

      Good luck in your search and hope Jay's answer following mine is more
      helpful.

      Peace.

      "kathy" <kathy@nospam.c om> wrote in message
      news:03b801c368 0a$9e2b5ef0$a10 1280a@phx.gbl.. .[color=blue]
      > "specific technical questions" means what? My question IS
      > a specific technical questions.
      >
      > your answer is useless.
      >[/color]


      Comment

      Working...