/// <summary> /// Returns the value of a mandatory item in the FormCollection /// </summary> /// <param name="items"></param> /// <param name="key"></param> /// <returns></returns> public static string GetRequiredString(this FormCollection items, string key) { if (items.HasKey(key) == false) { throw new ArgumentNullException("The " + key + " query string parameter was not found but is required"); } return(items.Single(x => x.Key.InvariantEquals(key)).Value); }