private static void SetClientRequestHeaders(DownloadRequest downloadRequest, AppSettings appSettings) { if (downloadRequest.MustAuthenticate) { var byteArray = Encoding.ASCII.GetBytes(appSettings.Username + ":" + ProtectionService.GetUnprotectedPassword(appSettings.Password)); Client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray)); } }
public SettingsDialog() { InitializeComponent(); AppSettings appSettings = ApplicationService.GetAppSettings(); txtUsername.Text = appSettings.Username; txtPassword.Password = ProtectionService.GetUnprotectedPassword(appSettings.Password); downloadDirectory = appSettings.DownloadDirectory; }
public SettingsDialog() { _appSettings = ApplicationService.GetAppSettings(); InitializeComponent(); txtUsername.Text = _appSettings.Username; txtPassword.Password = ProtectionService.GetUnprotectedPassword(_appSettings.Password); ConfigFilesList.ItemsSource = ApplicationService.NameConfigFiles(); }
private static void SetClientRequestHeaders(DownloadRequest downloadRequest, AppSettings appSettings) { if (!Client.DefaultRequestHeaders.Any()) { Client.DefaultRequestHeaders.UserAgent.ParseAdd($"GeonorgeNedlastingsklient/{Assembly.GetExecutingAssembly().GetName().Version.ToString()}"); } if (downloadRequest.MustAuthenticate) { var byteArray = Encoding.ASCII.GetBytes(appSettings.Username + ":" + ProtectionService.GetUnprotectedPassword(appSettings.Password)); Client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray)); } }