Hi, I have finished the chapter but had to go back to the first exercise of this chapter because of an error I cant seem to shake off,
In the exercise on page 702 it instructs you to insert the following code:
Code:
public static string FromAddress
{
get
{
string result = WebConfigurationManager.AppSettings.Get("FromAddress");
if (!string.IsNullOrEmpty(result))
{
return result;
}
}
throw new Exception("AppSettings FromAddress not found in web.config file.");
}
But I am getting errors for both "get" and "throw". For "get" it says 'AppConfiguration.FromAddress.get': not all code paths return a value and for "throw" it says "a get or set accessor expected".
I have inserted the using.System.Web.Configuration; to the top of the code.
Any help would be appreciated,
Nick