Hi Imar,
I pasted the wrong code. I was testing to see if I could get the error to throw in either case. The actual code I am using is which as far as I can see if straight from the book on page 702:
Code:
Public Shared ReadOnly Property ACHEmail() As String
Get
Dim result As String = WebConfigurationManager.AppSettings.Get("ACHEmail")
If Not String.IsNullOrEmpty(result) Then
Return result
End If
Throw New Exception("AppSetting ACHEmail not found in the web.config file.")
End Get
End Property
If I am reading this right is should be that if the key ACHEmail does not exist or is empty then throw the error. I tried removing my ACHEmail key as well as renaming it to ACHEmail1 as well as setting ACHEmail to "".
Any thoughts here. As I said in my previous post, I even ran the code from the book for Chapter 19 and the Final and removed one of the keys (specifically the FromAddress) from the web.config and I didn't get the error there either.
I do remember when I was working through the book that I got the error when testing this but now that I am creating a website I can't get it to work
Thanks for your response!