protected void SetContextInfo(HeContext heContext, SecurityTokenAPI.RequestSecurityTokenPayload authorizationPayload) { try { if (authorizationPayload.TenantId != 0) { heContext.Session.TenantId = authorizationPayload.TenantId; } if (authorizationPayload.UserId != 0) { heContext.Session.UserId = authorizationPayload.UserId; } } catch (Exception e) { OSTrace.Warning("Invalid authentication information.", e); } if (Request.Content.Headers.TryGetValues("Content-Language", out var headerValues)) { string locale = headerValues.First(); if (!string.IsNullOrWhiteSpace(locale)) { GenericExtendedActions.SetCurrentLocale(heContext, locale); } } else { OSTrace.Warning("Locale information missing from the request."); } }
private string GetTextResource(string espaceName, string resourceName, bool enableWarnings) { var resourceBinary = RuntimePlatformUtils.TryGetResourceBinary(resourceName, espaceName); if (resourceBinary != null && resourceBinary.Length > 0) { return(Encoding.UTF8.GetStringWithoutBOM(resourceBinary)); } if (enableWarnings) { OSTrace.Warning("Could not get " + resourceName + " file for '{0}'.", espaceName); } return(null); }