public Session GetLoginSession(string username, string password) { Session httpResponse = new Session(); Logging.Info("request", "Received request for GetLoginSession"); Logging.Info("GetLoginSession", "username: "******"GetLoginSession", "Begins."); UserInformation userInformation = SessionHelpers.Login(username, password); if (userInformation == null) { statusCode = (int)HttpStatusCode.Forbidden; httpResponse.Message = "boom"; } else { httpResponse.Message = "good"; httpResponse.username = userInformation.userName; Random random = new System.Random(); string sessionId; while (true) { sessionId = GenericHelpers.CreateMD5(random.Next(114514, 1919810).ToString()); string sessionKeyName = "EARTH_FUSION_SESSION_" + sessionId; if (RedisHelpers.GetString(sessionKeyName) == null) { RedisHelpers.SetString(sessionKeyName, userInformation.userId.ToString()); // three hour RedisHelpers.SetKeyExpireTime(sessionKeyName, 3 * 60 * 60); break; } } httpResponse.sessionId = sessionId; } httpResponse.StatusCode = statusCode; this.HttpContext.Response.StatusCode = statusCode; Logging.Info("request", "Reponse returned for GetLoginSession"); return(httpResponse); }