Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mujtaba Albinsaad 5 posts 74 karma points
    Dec 27, 2022 @ 12:05
    Mujtaba Albinsaad
    0

    Antiforgery Validation Exception

    I am getting below error on daily basis on a production website. Need your advise and support.

    Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery cookie ".AspNetCore.Antiforgery.6gJoQAZYAFw" is not present.

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Dec 27, 2022 @ 12:09
    Huw Reddick
    0

    Is it always on the same form,or different forms? Are you doing any Ajax posts?

  • Mujtaba Albinsaad 5 posts 74 karma points
    Dec 27, 2022 @ 12:15
    Mujtaba Albinsaad
    0

    Hi,

    We are not using Ajax posts. Until I am getting this error from one form, mainly with Arabic language.

    Please find the full logs for better view,

    System.InvalidOperationException: The exception handler configured on ExceptionHandlerOptions produced a 404 status response. This InvalidOperationException containing the original exception was thrown since this is often due to a misconfigured ExceptionHandlingPath. If the exception handler is expected to return 404 status responses then set AllowStatusCode404Response to true. ---> Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery cookie ".AspNetCore.Antiforgery.6gJoQAZYAFw" is not present. at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.ValidateRequestAsync(HttpContext httpContext) at Umbraco.Forms.Core.Attributes.ValidateFormsAntiForgeryTokenAttribute.ValidateFormsAntiForgeryTokenFilter.OnAuthorizationAsync(AuthorizationFilterContext context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Dec 27, 2022 @ 15:46
    Huw Reddick
    0

    how are your coding your form in the View? it would appear that it is not finding the Antiforgery token that the controller is expecting.

  • Mujtaba Albinsaad 5 posts 74 karma points
    Jan 04, 2023 @ 05:20
    Mujtaba Albinsaad
    0

    We are using Umbraco Forms.

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Jan 04, 2023 @ 11:39
    Huw Reddick
    0

    Unfortunately I have not used Umbraco Forms.

    If you view the page source for the form are you able to see the token?

    Are you posting the form to your own controller or is this also handled by Umbraco Forms?

  • Mujtaba Albinsaad 5 posts 74 karma points
    Jan 05, 2023 @ 07:04
    Mujtaba Albinsaad
    0

    Yes, antiforgery is there when we do inspect

    The Submission is handled by Umbraco Form plugin except we add extra input validation before submitting

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Jan 05, 2023 @ 08:14
    Huw Reddick
    0

    except we add extra input validation before submitting

    How are you doing the extra validation and submitting your form?

Please Sign in or register to post replies

Write your reply to:

Draft