A
A
Alexander Simonov2018-12-10 12:17:26
.NET
Alexander Simonov, 2018-12-10 12:17:26

Why does the method "continue" running after return?

Hello!
I have a .net core project with an action protected by reCaptcha.

public async Task<IActionResult> SignUp(UserSignUpModel model)
{
            var recaptchaRes = await _reCaptchaService.Validate(Request, !Startup.IsDevelopment);

            if (!recaptchaRes.success)
            {
                return BadRequest("ReCaptcha is invalid");
            }

            _userService.Signup(model);
}

For reCaptcha I use reCAPTCHA.AspNetCore ( https://github.com/TimothyMeadows/reCAPTCHA.AspNetCore)
I submit the form via axios.
The bottom line is, everything works fine on the local host, but the following happens in Azure: A
request is sent, 400 ("ReCaptcha is invalid") comes in and the user registers. I looked in chrome, only one request is sent. Maybe someone had a similar problem? Maybe .net core somehow repeats some requests in case of failure ... Maybe something else ...
Thanks everyone

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
spocher, 2018-12-10
@spocher

But who knows what is written in the library that you use. Why is this needed? In my projects where I use reCaptcha, I simply send requests through the built-in HttpClient according to the reCaptcha documentation and there are no problems.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question