Need a way to make HttpClient in c# work like axios in nodejs (with proxies)

128 views Asked by At

When im using axios into nodejs and set the httpAgent with a new instance of httpProxyAgent, it works well in nodejs and i dont get the cloudflare warning.

module.exports.GetClient = (proxy = null) => {
const headers = {
    "Content-Type": "application/json",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0",
}

const client = axios.create({
    headers,
    httpsAgent: new HttpsProxyAgent(module.exports.ParseProxy(proxy), { keepAlive: true }),
    httpAgent: new HttpProxyAgent(module.exports.ParseProxy(proxy), { keepAlive: true }),
})

return client;
}

When im using c# RestSharp or WebClient, i cant find a way to reproduce the same working system as axios with httpProxyAgent. Somebody can help me with that?

0

There are 0 answers