/// <summary> /// Format and store an iKey and appId pair into the dictionary of known correlation ids. /// </summary> /// <param name="ikey">Instrumentation Key is expected to be a Guid string.</param> /// <param name="appId">Application Id is expected to be a Guid string. App Id needs to be Http Header safe, and all non-ASCII characters will be removed.</param> private void GenerateCorrelationIdAndAddToDictionary(string ikey, string appId) { if (string.IsNullOrWhiteSpace(appId)) { return; } appId = HeadersUtilities.SanitizeString(appId); if (!string.IsNullOrEmpty(appId)) { this.knownCorrelationIds[ikey] = string.Format(CultureInfo.InvariantCulture, CorrelationIdFormat, appId); } }
/// <summary> /// Format and store an iKey and appId pair into the dictionary of known correlation ids. /// </summary> /// <param name="ikey">Instrumentation Key is expected to be a Guid string.</param> /// <param name="appId">Application Id is expected to be a Guid string. App Id needs to be Http Header safe, and all non-ASCII characters will be removed.</param> /// <remarks>To protect against injection attacks, AppId will be truncated to a maximum length.</remarks> private void GenerateCorrelationIdAndAddToDictionary(string ikey, string appId) { // Arbitrary maximum length to guard against injections. appId = StringUtilities.EnforceMaxLength(appId, InjectionGuardConstants.AppIdMaxLengeth); if (string.IsNullOrWhiteSpace(appId)) { return; } appId = HeadersUtilities.SanitizeString(appId); if (!string.IsNullOrEmpty(appId)) { this.knownCorrelationIds[ikey] = string.Format(CultureInfo.InvariantCulture, CorrelationIdFormat, appId); } }