Change DataManager Base Url

Can we change the base url for datamanager.

I'm currently using urladaptor but if i place the whole url it wont work.

Working

  let data = new DataManager({

    url: '/api/admin/category/getall',

    adaptor: new UrlAdaptor(),

    insertUrl: '/Home/Insert',

    updateUrl: '/Home/Update',

    removeUrl: '/Home/Remove',

    crossDomain: true,

  });

Not Working

  let data = new DataManager({

    url: 'https://localhost:5005/api/admin/category/getall',

    adaptor: new UrlAdaptor(),

    insertUrl: '/Home/Insert',

    updateUrl: '/Home/Update',

    removeUrl: '/Home/Remove',

    crossDomain: true,

  });


my react is running on aspnet core which has different port for react and api.


1 Reply

PS Pavithra Subramaniyam Syncfusion Team July 13, 2022 06:55 AM UTC

Hi Jayson Cabrera,


Thanks for contacting Syncfusion support.


From your code, we suspect that the issue occurs due to the CORS origin issue. So, we suggest ensuring that your API sample has configured the CORS to accept the cross-origin request from the react sample.


https://docs.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-3.1


If still, the issue persists, please share the below details that will be helpful for us to provide a better solution as early as possible.


  1. Share the Syncfusion package version
  2. Share the .net Core version you are using
  3. Is there any script error?
  4. Share the issue reproducible sample if possible


Regards,

Pavithra S


Loader.
Up arrow icon