Ends in:
0 DAY
19 HRS
1 MIN
44 SEC
Ends in:
0 D
19 H
1 M
44 S
Open Closed

The required antiforgery cookie ".AspNetCore.Antiforgery.dXGKnviEebk" is not present. #595


User avatar
0
ab created
  • ABP Framework version: v3.3.1
  • UI type: MVC
  • Tiered (MVC) or Identity Server Seperated (Angular): no
  • Exception message and stack trace:
  • The required antiforgery cookie ".AspNetCore.Antiforgery.dXGKnviEebk" is not present.
  • Steps to reproduce the issue:

I have created a custom blank page, that does not use the default/ lepthon, theme. On this page I do this simple call

(function () {

    immoRecommend.clientInformations.clientInformationManager.createLog
        ('7245a066-5457-4941-8aa7-3004778775f0', 'sdsd', 'kdkdkd', {
            type: 'POST',
            dataType: 'xml'
        })
        .then(function () {
            abp.notify.info('Successfully added!');
        });

})();

The AppService looks like:

    public class ClientInformationManager : ApplicationService, IClientInformationManager
    {
        [AllowAnonymous]

        public async Task CreateLogAsync(string ipContext, string agentContext, string referralCode)
        {

            ClientInformationCreateDto clientInformationCreateDto = new ClientInformationCreateDto();
            clientInformationCreateDto.IP = ipContext;
            await _clientInformationAppService.CreateAsync(new ClientInformationCreateDto());
        }
     }

I can call the API with swagger without any issues.

Options of AbpAntiForgeryOptions are not touched. When I disable AntiForgeryOptions like

    Configure<AbpAntiForgeryOptions>(options =>
            {
                options.AutoValidate = false;

            });

it works of cause. However, I want to have it enabled.

How can I make it work/ do I have to add something to my blank razor page since I dont use the default theme (and might miss a configuration?)

Thanks


1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi

    Try add

    to your page.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19