public ActionResult SearchByPhoto(PeopleSearchModel model, string returnUrl) { if (!Request.IsAuthenticated) { return(RedirectToAction("LogOnByUserName", "Account")); } Session["ComparedPhoto"] = null; byte[] userPhoto = (byte[])Session["ContentStream"]; double runTime = -1; try { if (Request.Form["Algorithm"] == null) { throw new Exception(); } support.Algorithm alg = support.Algorithm.EigenFaces; if (!Enum.TryParse <support.Algorithm>(Request.Form["Algorithm"].ToString(), out alg)) { throw new Exception(); } AccountMembershipService service = new AccountMembershipService(); MembershipPerson person = null; if (service.ValidatePerson(userPhoto, out person, alg, out runTime)) { Session["LastRecognitionAlgorithm"] = Enum.GetName(typeof(support.Algorithm), alg); Session["LastRecognitionTime"] = runTime; if (person != null) { Session["PersonForReview"] = person; Session["ComparedPhoto"] = userPhoto; return(View("PersonSearch")); } } } catch { } finally { // Session["ContentStream"] = null; // Session["ContentLength"] = null; // Session["ContentType"] = null; } ModelState.AddModelError("", "No record found."); return(View("PersonSearch")); }