View Single Post
  #1 (permalink)  
Old April 2nd, 2012, 08:10 AM
Nick Makin Nick Makin is offline
Authorized User
Points: 170, Level: 3
Points: 170, Level: 3 Points: 170, Level: 3 Points: 170, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Dec 2011
Posts: 43
Thanks: 11
Thanked 0 Times in 0 Posts
Default Chapter 19 page 702

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:
    public static string FromAddress
            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,

Reply With Quote