How to implement CORS in ASP.NET Core 3.1 (Cross Origin Resource Sharing)

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

Комментарии • 89

  • @ionutiancu5395
    @ionutiancu5395 3 года назад

    Brooooo, long may you live for this solution! I checked a lot of documentation and none of it was able to explain that without removing that backslash is not gonna work... unbelievable... Huge thanks, brother.

  • @charmedcoder7533
    @charmedcoder7533 4 года назад +8

    Thank you so much! I've been trying to resolve this issue and this video helped. Awesome video! Very precise, and you emphasized things that are required.

  • @hjolany1983
    @hjolany1983 2 года назад

    Thanks for your course, the question is:
    How can we specify the origins which have Authorization value in header shouldn't be block.

  • @nabhoyar
    @nabhoyar 3 года назад

    Thanks for explaining the implementation process in details. It was really great. Just want to recommend here that please explain the concepts of PreFlight as functionally this will help to understand the flow of CORS policy how it works and why it is needed. Rest video was awesome with good audio and video quality.

  • @jake_steffen
    @jake_steffen 3 года назад +1

    This had me tripped up all day, great video!

  • @j4jainam
    @j4jainam 2 года назад

    Nice Demo,
    But In my case I am only allowed to permit specific Origins so I can use the way of "Multiple origins"
    but my "Multiple origins" are not in my hand.. it is coming from a database table.. so How Can I use it ???

  • @745naga
    @745naga 2 года назад

    How fix cors when we have withcredentials true from client side. This methods fails when we send request with withcredentials

  • @blablabla2656
    @blablabla2656 3 года назад

    Awesome video! Clear,, straight to the point explanation. Thanks a lot!

  • @code_pilot
    @code_pilot 3 года назад

    Thank you so much ! that is what I was searching for the last two hours!!

  • @sandhyaray2771
    @sandhyaray2771 4 года назад +1

    Please make a video on CORS from Azure API Management Services perspective.

  • @purplepanther4153
    @purplepanther4153 2 года назад

    Whey I put the api code in website with port number, and create a client MVC application to use this API with a diffrent port and site on server, It fails. Cors errors. Not sure how to fix it on server. any ideas.. still blocked.

  • @LatinoTropico
    @LatinoTropico 2 года назад

    Thank you for another great video. My question is, do I need to use CORS as a security feature if a hacker finds a way to access my API from a different domain? If I do not use CORS at all in my API, will the standard HTTPS security be enough to stop such a hack? In my case, my API is only accessible from one domain and no other domains have access to that domain, due to other internal system security measures. So I should be ok not to use CORS?

    • @DotNetCoreCentral
      @DotNetCoreCentral  2 года назад

      Stopping hackers need a lot of stuff, HTTPS is definitely one of those, but there are other things like authentication with a faster expiring token, etc. CORS does not open up your API for hacking, your API could be called from a console that does not need API to support CORS.

  • @mukhtarshire9473
    @mukhtarshire9473 2 года назад

    Awesome video 👍

  • @RAM-ff8dy
    @RAM-ff8dy 4 года назад

    Great video...plz make a course on Asp net core API with Microservices and Azure functions,service bus ,App insights etc

  • @LeighBriody
    @LeighBriody 3 года назад

    Thanks for the help! Worked wonders !

  • @emalashkin
    @emalashkin 3 года назад

    Could you help me to get rid of the error "blocked by CORS policy" when hosting at IIS? I did exactly like you did but when I set Project properties --> Debug --> Launch --> IIS then the 'Access-Control-Allow-Origin' header is still missing.

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @emalashkin, I am not sure what IIS is doing, I don't even have IIS installed on my PC. I will try to see if I can reproduce this with IIS Express.

  • @nadeembackus2741
    @nadeembackus2741 3 года назад

    Thanks! had to remove the slash and it worked.

  • @bobflipinHHH
    @bobflipinHHH 3 года назад

    Thank you!! Really great explanation!

  • @hasnainali7368
    @hasnainali7368 3 года назад

    Thanks, it is comrehensive about how to configure for the APIs. But I think for new learner if you could explain that what is CORS and why it may or may not be needed would be helpful.

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @Hasnain Ali, thanks for watching! And thanks for the very good suggestion, I will figure something out on how to fix it.

  • @nadirsiddiqui9559
    @nadirsiddiqui9559 4 года назад

    Thanks for the video, can you please tell me why I am getting No 'Access-Control-Allow-Origin' header is present cors error

    • @DotNetCoreCentral
      @DotNetCoreCentral  4 года назад +1

      @nad sid, that would mean that it is not working as expected. Can you please give me a little more details on how you are using the code? Also if possible share it in GitHub or a gist.

  • @АлексейШкребнев-д4с

    Great video, thanks.

  • @viniciussantosaguiar9543
    @viniciussantosaguiar9543 3 года назад

    Your videos are the bests!

  • @aah134-K
    @aah134-K 2 года назад

    Amazing, you did very well thanks alot

    • @DotNetCoreCentral
      @DotNetCoreCentral  2 года назад

      Thanks!

    • @aah134-K
      @aah134-K 2 года назад

      @@DotNetCoreCentral i am facing an issue, when allowing the cors, but sending include authentication cookies from java script,
      Everything work except in java script.
      Api to web api no issue,
      Api to java script not working

  • @FlorinAsavei
    @FlorinAsavei 2 года назад

    Does Cors apply to api to api calls or just browser calls?

    • @DotNetCoreCentral
      @DotNetCoreCentral  2 года назад +1

      @Florin Asavei, yes it is only for Browsers, this is imposed for security reasons.

  • @infohpreet
    @infohpreet 2 года назад

    Nice👌

  • @ehsanmajdi6349
    @ehsanmajdi6349 3 года назад

    The best …perfect👏🏻

  • @c0rroslve
    @c0rroslve 4 года назад +1

    quick, & concise

  • @gorkemgenarakkaya4570
    @gorkemgenarakkaya4570 3 года назад

    First, thank you for this tutorial. But still I couldnt get rid of Cors error while trying to authenticate with Google. Can you help me for this ?

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @Görkem Genar Akkaya, I am not sure I understand what exactly google authentication has to do with a CORS implementation in your project. It will help if you can share your code in github.

  • @Glukosekoenig
    @Glukosekoenig 2 года назад

    If somebody of you guys have the same problem like me, that although everything is setup the same and the headers still not showing up, do you use windows authentication and anonymous is disabled? this thing was my problem, I spend hours to localize this issue.
    If you setup windows authentication and denying anonymous, all requests will show that now cors headers are shown. this message is misleading because the problem that those are missing is because the windows authentication failed. Unfortunately the browser doesn't tell you this and instead is crying about the cors headers. Your requests have to be changed that the windows credentials are given with the request and only then the cors policy is working like expected.
    cheers.

  • @Health-and-Energy
    @Health-and-Energy 4 года назад

    Thanks so much. Great example

  • @rohitpawar8710
    @rohitpawar8710 3 года назад

    clean explaination

  • @whoknows3764
    @whoknows3764 3 года назад

    Helped a lot!

  • @keyurpanchal6452
    @keyurpanchal6452 2 года назад

    Excellent

  • @AshwinKumar-yb1dl
    @AshwinKumar-yb1dl 3 года назад

    Thank You brother...!

  • @harishtanikonda303
    @harishtanikonda303 3 года назад

    How enable the cors globally in core 3.1..??

    • @DotNetCoreCentral
      @DotNetCoreCentral  3 года назад

      @
      harish tanikonda, I am not sure what you mean by globally. The example I have shown here will enable CORS for this particular service.

    • @harishtanikonda303
      @harishtanikonda303 3 года назад +1

      @@DotNetCoreCentral
      Services. Configure(options =>{
      options.Filters. Add(new CorsAuthorizationFilterFactory("CorsPolicy"));
      });
      The above code not working in core 3.1 but it works 2.2

  • @arman5782
    @arman5782 3 года назад

    omg that workedddddddddddddddddddddddddd thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

  • @katiaeleuterio3596
    @katiaeleuterio3596 3 года назад

    Great job, thanks!!!

  • @simonmoyo9120
    @simonmoyo9120 3 года назад

    You're a superstar

  • @mounikreddypeddy1945
    @mounikreddypeddy1945 4 года назад

    Super bro

  • @mamnoonsami6193
    @mamnoonsami6193 3 года назад

    Thank you so much.

  • @P90Ez
    @P90Ez 3 года назад

    my fkn god, im just trying to get some data in to an html to display this in obs, why has this to be so much pain?
    Thanks for the vid!

  • @mounikreddypeddy1945
    @mounikreddypeddy1945 4 года назад

    Complete cors.. 👍

  • @fazalabbas7407
    @fazalabbas7407 3 года назад

    Thank You Sir

  • @notWinze
    @notWinze 4 года назад

    Ty bro

  • @anatolec1480
    @anatolec1480 4 года назад

    thx !

  • @Gamer-bg7rb
    @Gamer-bg7rb 2 года назад

    Спасибо узбэк

  • @yodhrajpatil33
    @yodhrajpatil33 4 года назад

    :D