Re: Structure analogous to web.config in a windows application???

From: Tal Sharfi (talsharf_at_netvision.net.il)
Date: 09/21/04


Date: Wed, 22 Sep 2004 00:00:36 +0200

hi

you can use the App.Config file. if you don'a have it yet on your project,
then, right click the project in the solution explorer->add new item->
choose 'Application Configuration'.
then edit it to something like:
<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<appSettings>

<add key="MyKey" value="MyData" />

</appSettings>

</configuration>

and then you can access the data in the code by using:
using System.Configuration;

AppSettingsReader appSettings = new AppSettingsReader();

objetc = appSettings.GetValue("MyKey",typeof(System.String));

hope that will help

Tal Sharfi

"Novice" <6tc1ATqlinkDOTqueensuDOTca> wrote in message
news:1524CEA0-B8E0-4B94-86C5-B8D6C7286586@microsoft.com...
> Hey everyone - is there a file in a windows application that is analogous
> to
> the web.config in ASP.NET applications?
>
> Basically, I want to store a bunch of strings (that are NOT confidential)
> in
> a common configuration file and that I can easily access like the
> web.config
> file for ASP.NET applications.
>
> In summary I would like a place to store configuration information for a
> windows application and the methods I use to access that information.
>
> Thanks,
> Novice



Relevant Pages

  • RE: Share AppSettings configuration between a service Web and an asp.net web application
    ... the IIS root site and modify the AppSettings section in it, ... Here is a test function which open & modify web.config file in IIS site ... Microsoft MSDN Online Support Lead ... Share AppSettings configuration between a service Web and an ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: web.config
    ... You definitely provided more information in that response. ... First off, the App Settings section appears under the configuration tags, ... It is not an <appsettings> section. ... > "Pete Wright" wrote in message ...
    (microsoft.public.dotnet.languages.vb)
  • Re: ConnectionString not initialized..?
    ... The appSettings key must be within ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Shared app.config
    ... Its located in the CONFIG directory of the runtime install path ... > This situation requres many exes to be sitting on a network share. ... > in the appSettings configuration section. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: appsetting in class doesnt work
    ... I think it may make you want to hurl at what MS has done with configuration ... an appsettings section. ... Dim cnfg As System.Configuration.Configuration ... the settings enter in the designer. ...
    (microsoft.public.dotnet.languages.vb)