Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Usage of WebClient() to HttpClient() #61

Closed
jeremy-farrance opened this issue Jan 4, 2025 · 4 comments
Closed

Change Usage of WebClient() to HttpClient() #61

jeremy-farrance opened this issue Jan 4, 2025 · 4 comments
Assignees

Comments

@jeremy-farrance
Copy link
Contributor

I haven't researched this well, but the Recaptcha.cs code is still using WebClient() and should be updated to using System.Net.Http and then change the code to something like:

Note: this is an example from our Cloudflare Turnstile implementation, NOT intended as the way to update the existing Google reCaptcha code.

var client = new HttpClient();

dynamic jsonObject = new { secret = privateKey, response = encodedResponse};
var content = new StringContent(JsonConvert.SerializeObject(jsonObject), System.Text.Encoding.UTF8, "application/json");
      
//URL updated per https://developers.cloudflare.com/turnstile/migration/recaptcha/
var CloudflareReply = await client.PostAsync("https://challenges.cloudflare.com/turnstile/v0/siteverify", content);
@iJungleboy
Copy link
Contributor

@ropalko this seems to be correct, WebClient seems deprecated and we should use HttpClient.

@ropalko
Copy link
Contributor

ropalko commented Jan 6, 2025

Update web client to httpclient. Thank you for the hint =)

@ropalko ropalko closed this as completed Jan 6, 2025
@iJungleboy
Copy link
Contributor

@ropalko completed - but not published? or is that in a few mins ;) ?

@ropalko
Copy link
Contributor

ropalko commented Jan 6, 2025

Also made a new release for 2sxc 19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants