First thanks for chiming in!!!
Yes I am getting a blank value.
The best way to describe my app.config, enter a name to reference i.e.
"Test" and then enter a string value for "test" i.e. "Hello". I would
copy-n-paste my simple app.config here but needed to more forwards with an
alternate solution until my original question could be solved and now using
XML
This is my solution away from app.config in the DLL until someone can tell
me the correct method to read app.config from a supporting DLL
Public Class ReadConfiguration
Private strLogFile As String
Private strSendToMailAddress As String
Private strFromMailAddress As String
Private strServer As String
''' <summary>
'''
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property LogFile() As String
Get
Return strLogFile
End Get
Set(ByVal value As String)
strLogFile = value
End Set
End Property
Public Property SendToMailAddress() As String
Get
Return strSendToMailAddress
End Get
Set(ByVal value As String)
strSendToMailAddress = value
End Set
End Property
Public Property FromMailAddress() As String
Get
Return strFromMailAddress
End Get
Set(ByVal value As String)
strFromMailAddress = value
End Set
End Property
Public Property Server() As String
Get
Return strServer
End Get
Set(ByVal value As String)
strServer = value
End Set
End Property
Sub New()
If IO.File.Exists("unhandledExceptions.xml") Then
Using ConfigurationFile As New
System.Xml.XmlTextReader("unhandledExceptions.xml" )
ConfigurationFile.WhitespaceHandling =
System.Xml.WhitespaceHandling.None
Do While ConfigurationFile.Read()
If ConfigurationFile.NodeType =
System.Xml.XmlNodeType.Element Then
Select Case ConfigurationFile.Name
Case "PrimaryLogFile"
LogFile = ConfigurationFile.ReadString
Case "SendEmailTooAddress"
SendToMailAddress = ConfigurationFile.ReadString
Case "EmailFromAddress"
SendToMailAddress = ConfigurationFile.ReadString
Case "SmtpClientServer"
Server = ConfigurationFile.ReadString
End Select
End If
Loop
End Using
End If
End Sub
End Class
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<UHE>
<PrimaryLogFile>logExceptions.txt</PrimaryLogFile>
<SendEmailTooAddress></SendEmailTooAddress>
<EmailFromAddress></EmailFromAddress>
<SmtpClientServer></SmtpClientServer>
</UHE>
"Spam Catcher" <sp**********@rogers.comwrote in message
news:Xn**********************************@127.0.0. 1...
"Kevin S Gallagher" <ke***************@state.or.uswrote in
news:er**************@TK2MSFTNGP04.phx.gbl:
>I have been attempting to read a value from the starting executable
while in a DLL.
So far have tried the following were "Test" is a defined value in the
EXE. What is returned is a blank/empty string
System.Configuration.ConfigurationManager.AppSett ings.Item("Test")
Did some research on Google but only found people untried suggestions,
none that work in .NET Framework 2.
That usually works fine for me.
Are you getting a blank value? how does your App.config look like?