public ActionResult removeFave(int[] removefavorite) { SmartService smartService = new SmartService(); string key, toHash, token; token = smartService.AuthToken(); if (token == "") { } else { // Create a validation key based on the current logged in username and authentication token string username = User.Identity.Name; toHash = username.ToUpper() + "|" + token; key = smartService.GetMd5Hash(MD5.Create(), toHash) + "|" + username; AccountType Account = smartService.GetAccountDetails(key, username); foreach (int fav in removefavorite) { try { TempData["Message"] = smartService.DeleteFavourite(Account.userId, fav); //not working? } catch (Exception ex) // apparently not throwing the expected fault exception. handling argument exception instead. { if (ex is FaultException) { TempData["Error"] = "Error Message: " + ex.Message; } if (ex is ArgumentException) { TempData["Error"] = "Error Message: " + ex.Message; } } } } return(RedirectToAction("Favourites")); }