Re: Shared app.config
From: Stephen Muecke (stevejo_at_senet.com.au)
Date: 03/05/04
- Next message: Charles Law: "Re: Inheriting from UserControls"
- Previous message: Scott M.: "Re: The Pipe Symbol"
- In reply to: Eric Sabine: "Shared app.config"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 6 Mar 2004 09:01:33 +1030
Eric,
You can put the settings in the machine.config file.
Its located in the CONFIG directory of the runtime install path
(System.Web.Hosting.SimpleWorkerRequest.MachineConfigPath Property will
return the path)
machine.config already contains an <appSettings> although it is commented
out
AppSettingsReader first checks this file before checking the applications
configuration file
Stephen
"Eric Sabine" <mopar41@____h_o_t_m_a_i_l_._ScPoAmM> wrote in message
news:OF$jW4sAEHA.2040@TK2MSFTNGP12.phx.gbl...
> This situation requres many exes to be sitting on a network share. I
would
> like all of these to use the same app.config file, which will be stored in
> the same location on the network. A quick test though gave me this
> exception:
>
> System.InvalidOperationException: The key 'ConnectionString' does not
exist
> in the appSettings configuration section.
> at System.Configuration.AppSettingsReader.GetValue(String key, Type type)
> at test_appconfig.Form1.FromApplicationConfig(String Key) in
> F:\VB.NET\junk\test_appconfig\test_appconfig\Form1.vb:line 62
> The program '[2808] test_appconfig.exe' has exited with code 0 (0x0).
>
> What's the best way to share the app.config in this common network folder?
> Thanks, Eric
>
>
> Public Function FromApplicationConfig(ByVal Key As String) As String
> Try
> Dim reader As New AppSettingsReader
> Return CStr(reader.GetValue(Key, GetType(String)))
> Catch ex As Exception
> MessageBox.Show(ex.Message.ToString & vbCrLf & _
> ex.Source.ToString & vbCrLf & _
> ex.StackTrace.ToString, "Function: FromApplicationConfig Exception",
> MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
> End Try
> End Function
>
>
- Next message: Charles Law: "Re: Inheriting from UserControls"
- Previous message: Scott M.: "Re: The Pipe Symbol"
- In reply to: Eric Sabine: "Shared app.config"
- Messages sorted by: [ date ] [ thread ]