Switch to English?
Yes
Переключитись на українську?
Так
Переключиться на русскую?
Да
Przełączyć się na polską?
Tak
Post your project for free and start receiving proposals from freelancers within minutes after publication!

Проблема с CORS на ASP.NET Web API

C#

  1. 124  
    1 day7 USD

    Добрый день! Готов настроить CORS в вашем проекте за кратчайшие сроки.

  • Profile deleted
    14 April 2021, 1:20 |

    Можно узнать как вы добавляете cors в программном коде и настраиваете его? Может где-то по ссылке можно посмотреть?

  • Leonid Martynyuk
    14 April 2021, 17:33 |

    можно

    https://drive.google.com/open?id=1Qm0yzqRebb4DSVP-OVNrk2WhdGRFzYHA


    интересно  что  корс  вываливается   когда  добавляешь  в  запрос  contentType: "application/json" 



  • Profile deleted
    14 April 2021, 22:49 |

    Доступ запросила на документ
    Вы уверены что ошибка cors? Т/е например в отладчике в браузере при запросе на адрес видите ошибку со словом Origin, например Acccess-Control-Allow-Origin?
    В webapi добавление EnableCors()/AddCors()/UseCors() и настроиваете его на адреса с которых будут запросы, заголовки(для application/json ставите *) и на любые методы - * либо глобально, либо перед контроллером

  • Leonid Martynyuk
    14 April 2021, 23:11 |

    разрабы   фронтенда   говорят  да.  надо  уточнить  что оно  конкретно им пишет

  • Profile deleted
    15 April 2021, 2:59 |

    И самое важное

    CORS - для безопастности, мы регулируем какие домены(origins) могут обращаться к вашим WebAPI с какими заголовками(application/json) и какие запросы(PUT, DELETE,...) им разрешены

    Т/е мы его используем для ограничения - для безопасности

    Например, у меня есть Web API .Net он запущен на моем сервере и внутренний адрес: localhost:3000, а внешний https://examle.com

    Внутри программы .net я пишу 

    services.AddCors();

    AllowAnyHeader() - разрешаю любые заголовки в том числе application/json; 

    AllowAnyMethod(); - разрешаю любые методы PUT, POST, … 

    У меня указано WithOrigins(“http://localhost:3000”)!! т/е к моему api могут обращаться только сервисы запущенные с текущего локального сервера и порта (with origin: localhost:3000/* or example.com/*(nginx настройки)) иначе будет ошибка

    Попробуйте добавить адреса с которых обращается фронтендер, например в WebAPI .net перед контроллерами

    [EnableCors(origins: "http://www.адрес-фронтендера.com", headers: "*", methods: "*")]

    public class ItemsController : ApiController {}

    Или глобально 

Current freelance projects in the category C#

S1GG1L

A person is needed who can take the initial code of the Minecraft launcher for the project, change the design at their discretion, but there are small style requirements for it to be in purple tones. Regarding payment, please suggest a price for the work. However, the budget is…

C#Gaming Apps ∙ 1 day 2 hours back ∙ 5 proposals

Improvement in the existing version of 1C retail block for the distribution center (DC)

In general, I will explain what kind of database we have - There is a main server where there is a retail database (where all receipts are recorded) - a UTP database - where all sales are transferred - it calculates the markup and stock balances - small databases of retail…

C & C++C# ∙ 6 days 2 hours back ∙ 6 proposals

It is necessary to migrate the current working program from FoxPro to C#.

Hello everyone! We have a program in FoxPro (it has several modules, it's an accounting program), we have the source code of the program, and if necessary, we can consult with people who support the current program. What needs to be done: 1. Analyze how everything works,…

C#Desktop Apps ∙ 8 days 17 hours back ∙ 18 proposals

Junior C#

We are looking for a talented and ambitious Junior C# developer who is eager for professional growth and new challenges. Your future tasks: - Development and support of backend solutions with frontend (Telegram bot); - Automation of routine processes in Android development,…

C# ∙ 9 days 7 hours back ∙ 9 proposals

Client
Leonid Martynyuk
Ukraine Kharkiv  63  0
Project published
5 years back
77 views