public ActionResult DeleteElementConfirm(Int64 id /*chart id.*/, Int64 elementId, String returnUrl) { try { if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { ChartRepository.DeleteElementFromChart(elementId, id, GetUserId()); return(Redirect(returnUrl)); } return(RedirectToAction("DataSet", new { id })); } catch (Exception e) { ExceptionMessageToViewBag(e); return(View("Error")); } }