namespace Common.UI.Models { using System.Net.Http; using System.Threading.Tasks; public class HttpContext { private static readonly HttpClient httpClient = new HttpClient(); internal static async Task GetEncryptionKeyAsync(string urlFormat, int serienNr) { var encryptionKey = default(string); using (var httpResponeMessage = await httpClient.GetAsync(string.Format(urlFormat, serienNr))) { if (httpResponeMessage.IsSuccessStatusCode) { var content = await httpResponeMessage.Content?.ReadAsStringAsync(); encryptionKey = content?.Trim('"'); } } return encryptionKey; } } }