public ActionResult Activate() { // Redirect if the user is logged in already if (IdentityModel.CurrentUserLoggedIn) { return(RedirectToAction("Account", "Logged")); } var model = new ActivateModel { // Set default Gender = 0 }; string token; try { // Get the token from the RouteData token = SqlInjection.SafeSqlLiteral(Url.RequestContext.RouteData.Values["id"].ToString()); } // ReSharper disable EmptyGeneralCatchClause catch (Exception) // ReSharper restore EmptyGeneralCatchClause { return(RedirectToAction("Index", "Home")); } // Redirect if the token is invalid or missing if (String.IsNullOrEmpty(token) || token.Length != 32) { return(RedirectToAction("Index", "Home")); } if (!ActivateModel.CheckAccount(token)) { return(RedirectToAction("Account", "Logged")); } // Get values form the database model.GetValues(token); return(View(model)); }