feat: proxy creds

This commit is contained in:
2026-03-09 14:39:25 +01:00
parent 49c963078a
commit d3d704ebf4
2 changed files with 8 additions and 8 deletions

View File

@@ -20,13 +20,13 @@ namespace CarManagerV3.Forms
public NetworkCredential GetCredentails()
{
System.Diagnostics.Debug.WriteLine($"Username: {tbxUsername.Text}, Password: {tbxPassword.Text}");
return new NetworkCredential(tbxUsername.Text, tbxPassword.Text);
}
private void NetCredentials_Load(object sender, EventArgs e)
{
this.BringToFront();
this.Focus();
}
private void btnAccept_Click(object sender, EventArgs e)

View File

@@ -99,13 +99,12 @@ namespace CarManagerV3
using (var client = new System.Net.WebClient())
{
client.Headers.Add("Referer", "http://localhost");
if (myNetCred != null)
{
client.Proxy.Credentials = myNetCred;
}
try
{
if (myNetCred == null) throw new WebException();
client.Credentials = myNetCred;
client.Proxy.Credentials = myNetCred;
//DEBUG:: if (myNetCred == null) throw new WebException();
client.DownloadFile(url, path);
}
catch (WebException ex)
@@ -127,11 +126,12 @@ namespace CarManagerV3
}
NetCredentials netCredForm = new NetCredentials();
DialogResult dialogRes = netCredForm.ShowDialog();
netCredForm.BringToFront();
netCredForm.Focus();
if (dialogRes == DialogResult.OK)
{
NetworkCredential netcred = netCredForm.GetCredentails();
myNetCred = netcred;
System.Diagnostics.Debug.WriteLine($"Got credentials: {netcred.UserName}, {netcred.Password}");
FetchImage(car);
return;
} else