public string BuildToken(BVSDAdmin user) { //TODO: use Convert.ToBase64String() instead of HtmlEncode() if (((user?.ID ?? 0) == 0) || ((user?.School?.ID ?? 0) == 0) || (string.IsNullOrWhiteSpace(user?.Name))) { return(null); } else { lock (_icCipherService) { return(System.Web.HttpUtility.HtmlEncode(_icCipherService.Encrypt_ECB( string.Format("{0}={1}&{2}={3}&{4}={5}", bocTokenKeyPersonID, user.ID, bocTokenKeySchoolID, user.School.ID, bocTokenKeyUser, user.Name)))); } } }