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

Cannot Instantiate 2Captcha Object in .Net6. #26

Closed
shishank-bsc opened this issue Feb 13, 2024 · 3 comments
Closed

Cannot Instantiate 2Captcha Object in .Net6. #26

shishank-bsc opened this issue Feb 13, 2024 · 3 comments

Comments

@shishank-bsc
Copy link

shishank-bsc commented Feb 13, 2024

I am trying to integrate 2Captcha service in my .Net6 Application.

I have installed this nuget package: https://www.nuget.org/packages/2captcha-csharp/

I added the namespace: using TwoCaptcha.Captcha;

But I am not able to instantiate the object:

TwoCaptcha solver = new TwoCaptcha('YOUR_API_KEY');
reCAPTCHA captcha = new reCAPTCHA();
Getting error here.

How can I resolve this?

https://stackoverflow.com/questions/77986229/cannot-instantiate-twocaptcha-object-in-net-6

@tuannh6495
Copy link

TwoCaptcha.TwoCaptcha solver = new TwoCaptcha.TwoCaptcha(ApiKey);
I got same your issue. I should try it!

@tuannh6495
Copy link

#2

@victorkowalski
Copy link
Contributor

victorkowalski commented Oct 24, 2024

Example of use: @shishank-bsc @tuannh6495

namespace ConsoleApp1
{
    using TwoCaptcha;
    using TwoCaptcha.Captcha;
    using TwoCaptcha.Exceptions;

    class Program
    {

        static void Main(string[] args)
        {
            TwoCaptcha solver = new TwoCaptcha("55555555555555555555");

            Text captcha = new Text("If tomorrow is Saturday, what day is today?");

            try
            {
                solver.Solve(captcha).Wait();
                Console.WriteLine("Captcha solved: " + captcha.Code);
            }
            catch (AggregateException e)
            {
                Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
            }
        }
    }
}

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

4 participants