27 lines
790 B
C#
27 lines
790 B
C#
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<string> 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;
|
|
}
|
|
}
|
|
}
|