public async Task <IActionResult> s(string hash) { theUrl = await _urlRepo.GetUrlByShortUrl(hash); if (theUrl == null) { _log.LogWarning($"Redirect failed. The url could not be found."); return(Content($"Redirect failed. The url could not be found.")); } theUrl.Counter = theUrl.Counter + 1; theUrl.LastAccessed = DateTime.Now; await _urlRepo.UpdateUrl(theUrl.Id, theUrl); if (!theUrl.OriginalUrl.Contains("http://") || !theUrl.OriginalUrl.Contains("https://")) { return(Redirect("http://" + theUrl.OriginalUrl)); } return(Redirect(theUrl.OriginalUrl)); }