public ActionResult Favourites() { SearchResultsList ResultList = new SearchResultsList(); try { if (!Request.IsAuthenticated) { //must be logged in to see this page, so kick em out if they arnt. TempData["Error"] = "You must be logged in to view your favourites"; return(RedirectToAction("Index", "Home")); } 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); FullResultsType results = smartService.GetFavourites(key, Account.userId); if (results.numResults == 0) { } else { foreach (ArticleType at in results.contentTypeResults) { //do this with a model instead SearchResults SearchResults = new SearchResults(); SearchResults.articleId = at.articleId; SearchResults.reprintOpprtunityId = at.reprintOpprtunityId; SearchResults.articleTitle = at.articleTitle; SearchResults.authors = at.authors; SearchResults.journalTitle = at.journalTitle; SearchResults.publicationDate = at.publicationDate; SearchResults.citation = at.citation; SearchResults.PDFlink = at.PDFlink; SearchResults.abstractText = at.abstractText; SearchResults.keySentence = at.keySentence; ResultList.SearchResultObjList.Add(SearchResults); } } } } catch (Exception ex) // apparently not throwing the expected fault exception. handling argument exception instead. { if (ex is FaultException) { TempData["Error"] = "Error Message: " + ex.Message; //TempData["ErrorDetail"] = "Error Detail: " + ex.Detail.errorDetails; } if (ex is ArgumentException) { TempData["Error"] = "Error Message: " + ex.Message; } } return(View(ResultList)); }