Well when i send this request without connecting to my tunnel internet connection this works super well.( works well gives me the response code )
But when i send this request while i am connected to my vpn this doesnt work it gets a timeout error even if the proxy is dead. ( doesnt work no response code but a timeout )
I dont know why maybe its because my Private vpn host is ( something like : example.hackquest.com ) Its a tunnel connection.
Maybe the proxy is not resolving it but i checked it with other proxy checking applications while my Vpn was turned on ( on those application i get the dead or alive response even if I am using the Vpn )
Is there anything missing in my code. Is there something more to add to fix this issue.
using System;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static async Task Main(string[] args)
{
HttpClientHandler handler = new HttpClientHandler
{
Proxy = new WebProxy("http://172.121.142.102:3128"),
UseProxy = true
};
HttpClient client = new HttpClient(handler);
string url = "http://google.com";
HttpResponseMessage response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
Console.WriteLine("Status Code: " + (int)response.StatusCode);
}
else
{
Console.WriteLine("Request failed with status code: " + (int)response.StatusCode);
}
}
}
}