Open Closed

How to disable antiforgery and/or enable cors? #7808


0
dparizek created

I am trying to disable antiforgery at least temporarily so that I can use Telerik Reporting and it will not pass the antiforgery cookie:

@{ SetAntiForgeryCookie(); }

I can see cookie in browser console but Telerik not passing it and also Telerik talks of enabling Cors.

When I add:

Configuration.Modules.AbpWeb().AntiForgery.IsEnabled = false;

to my ApplicationModule PreInitialize method then I am missing a Using statement as it does not recognize AbpWeb()

What would be the Using statement? I tried using Abp.Configuration.Startup; no luck.

Also, I cannot find any EnableCores function in my codebase... where does that go if I want to enable Cors?


1 Answer(s)
  • 0
    maliming created

    You can disable or configure it in your web module's PreInitialize method.

    Configuration.Modules.AbpWeb().AntiForgery.IsEnabled = false;
    

    about Cors please see: https://support.aspnetzero.com/QA/Questions/2791#answer-8fe4c107-a627-4cd5-9c6a-c00939ff2aa4