I'm pretty sure the exception is thrown from the line:
string[] lineOfContents = File.ReadAllLines(ConfigurationManager.AppSettings["FiletextPath"]);
Check your
app.config
file and the
FiletextPath
app setting. Either it's missing, you've spelled it wrong or the value is empty.