private int ReadInt(string name, int defaultValue)
{
string temp = ConfigurationManager.AppSettings[name];
if (String.IsNullOrEmpty(temp))
return defaultValue;
int result = 0;
if (!Int32.TryParse(temp, out result))
throw new Exception(String.Format("{0} must be a number: {1}", name, temp));
return result;
}