public IActionResult Retrieve(string hash) { try { Link link = repo.ReadShortUrl(hash); repo.IncrementUrlClickCount(link); return(Redirect(link.Redir)); } catch (Exception) { // If the short url is not found we'll redirect the user to the homepage by default!! return(RedirectToRoute("homepage")); } }