public ActionResult LogOn(string returnUrl = null, string token = null) { if (returnUrl != null) { if (returnUrl.Contains('%')) { try { returnUrl = Server.HtmlDecode(returnUrl); } catch {} } } if (AuthUtility.IsAuthenticated(User.Identity)) { return(RedirectToLocal(returnUrl)); } if (!string.IsNullOrEmpty(token)) { AuthenticationTicket ticket = IdentityAuth.GetTicketFromToken(token); if (ticket != null) { var identity = ticket.Identity; if (identity != null && identity.IsAuthenticated) { var userId = identity.GetUserId <long>(); var user = _userManager.FindById(userId); if (user != null) { _signInManager.SignIn(user, false, false); // Writelog(string.Format("allowanonymous log: {0}",user.UserName)); return(RedirectToLocal(returnUrl)); } } } } return(View()); }