✅ RestSharp not using / ignoring given proxy

Hey, I wanted to ask if anyone here has experience with RestSharp and can help me fix this issue, for longer now i have noticed that my C# script is ignoring the proxy im giving to it I made sure that its the correct proxy and correct protocol, yet somehow my function returns my real IP address and not the given proxy
public string currentProxy(string _proxy, int port)
{
try
{

RestClient client = new RestClient();
if (_proxy != null) { client.Options.Proxy = new WebProxy("socks5://" + proxy, port); }



Console.WriteLine(proxy);
var response = client.ExecuteGet(request: new RestRequest("https://ifconfig.me"));
if ((int)response.StatusCode != 200)
{
Console.WriteLine((int)response.StatusCode);
return null;
}
return response.Content.Replace("\n", "");

} catch { return null; }
}
public string currentProxy(string _proxy, int port)
{
try
{

RestClient client = new RestClient();
if (_proxy != null) { client.Options.Proxy = new WebProxy("socks5://" + proxy, port); }



Console.WriteLine(proxy);
var response = client.ExecuteGet(request: new RestRequest("https://ifconfig.me"));
if ((int)response.StatusCode != 200)
{
Console.WriteLine((int)response.StatusCode);
return null;
}
return response.Content.Replace("\n", "");

} catch { return null; }
}
9 Replies
The Fog from Human Resources
(for more info, instead of using my proxy it uses my real IP address) The proxies even work on curl requests
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
The Fog from Human Resources
whats TLDR the proxy thing has worked before but suddenly it stopped
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
The Fog from Human Resources
how to set a proxy on HttpClient then
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
The Fog from Human Resources
yes but curl confirmed that the proxy is indeed working
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
The Fog from Human Resources
porting the entire code to not use RestSharp is way too large of a task now ill just use the constructed HttpClient and parse it into a RestClient
Want results from more Discord servers?
Add your server