Тёмный

Understanding CORS with ASP.NET Core C# 

Raw Coding
Подписаться 71 тыс.
Просмотров 12 тыс.
50% 1

CORS is a browser security feature that stops requests across origin's. Today we learn how to configure ASP.NET Core manually to resolve CORS issues to understand the moving parts.
Patreon 🤝 / raw_coding
Courses 📚 learning.raw-coding.dev
Shop 🛒 shop.raw-coding.dev
Discord 💬 / discord
Twitter 📣 / anton_t0shik
Twitch 🎥 / raw_coding
docs: developer.mozilla.org/en-US/d...
#csharp #aspnetcore #cors

Опубликовано:

 

21 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 27   
@rustamhajiyev
@rustamhajiyev Год назад
Epic explanation! Gets directly into the golden collection 😍Thank you!
@newmonengineering
@newmonengineering Год назад
Well explained. I understand it a bit better now. I already knew how to fix the errors but this added a bit more depth to my understanding. I never saw it done the manual way before, it makes more sense. Thanks.
@col_rod
@col_rod Год назад
Thank you, thank you and thank you! Finally I got to understand this topic. Really well explained as always. Again thanks!
@stephenadams6959
@stephenadams6959 Год назад
Another great well explained video. Thanks heaps for making it.
@meetingattender8132
@meetingattender8132 Год назад
Very informative like no other. Thank you!
@user-fd3yr5eo4g
@user-fd3yr5eo4g 9 месяцев назад
Well explained, one of the best video I have watched for CORS. Thanks for that.
@nt2548
@nt2548 5 месяцев назад
Good explanation. Thank you
@user-fj2oe5cl8j
@user-fj2oe5cl8j 6 месяцев назад
You are a god thank you. very nice video💙
@waqasmumtaz6109
@waqasmumtaz6109 11 месяцев назад
Liked And Already Subscribed Bro
@seangwright
@seangwright Год назад
Nice clear overview! If you needed to dynamically apply CORS configuration based on the request (which origin, is the request authenticated, ect...) can this be done with the built-in ASPNET Core "UseCors" middleware or should this be a completely custom built middleware?
@jub0bs
@jub0bs Год назад
As mentioned at 15:42, you're better off using an existing CORS middleware library, in particular because implementing CORS "from scratch" (unless you're intimately familiar with the protocol) is error-prone.
@Tamer_Ali
@Tamer_Ali 6 месяцев назад
Thanks Anton for the awesome video how to load origins dynamically from database ?
@ahmedifhaam7266
@ahmedifhaam7266 Год назад
are you reading my messages?? I literally just asked this question holy shi* man holy falgget blacakaty magati shiiii- Thank Yoouuuu
@gt10i
@gt10i Месяц назад
I have one question about the first part of the video. Unless I missed it, there was no preflight request for "Access-Control-Allow-Origin". Is it implicit? The server still has to first reply, and tell the browser that it allows CORS, right?
@davestorm6718
@davestorm6718 13 дней назад
Still trying to figure out what CORS actually protects from: CORS is easily bypassed, for starters. As soon as you have the server set up to allow certain origins, methods, etc, then you no longer have the same security level (the session mechanism will be sent over just like normal). I don't get how this helps with security.
@vdrychyk
@vdrychyk Год назад
I have several POST endpoints in my controller, how can I allow CORS only for one of them and disallow it for others?
@joehernandez3231
@joehernandez3231 5 месяцев назад
You would create a named policy like he does in the video towards the end. The difference is you don't enable CORS everywhere with app.UseCors(...); instead you enable it on the endpoint with an attribute: [EnableCors("Policy1")].
@marwanalakrass1688
@marwanalakrass1688 Год назад
Thanks for well explained video, can I use CORS to allow or disallow calls to my APIs from mobile apps ? if yes How to do so ?
@RawCoding
@RawCoding Год назад
Did you miss the part where it’s a browser security feature?
@marwanalakrass1688
@marwanalakrass1688 Год назад
@@RawCoding Seems I did, What is the best way to secure my APIs ?
@RawCoding
@RawCoding Год назад
Put it on a private network
@codingbloke
@codingbloke Год назад
As someone not already familiar with CORS at this depth I found this a little too fast. Especially when it came to the allow credentials part where Creds and "cookies" seem to get conflated and from the point I was completely lost. Will have re-watch to see if I can unpick it.
@RawCoding
@RawCoding Год назад
if you implement cross origin authentication, you'll quickly realise how to fix it using that header.
@ahmedifhaam7266
@ahmedifhaam7266 Год назад
@@RawCoding for example if you use identity4 for your own api, client and server auth, i came across this issue, ?
@SergeiFedorov77
@SergeiFedorov77 7 месяцев назад
I've been reading and looking around to understand CORS and I got a pretty good idea about it now. I have a problem where the preflight, when my webapi is deployed to the server, always returns a 401 Unauthorized. I'm calling the webapi from a vue-site installed on the same server but different site and port. I used the app.useCors but it still didn't work when deployed. So then I expliclty put the headers for allowing origins but I still get the 401 from the preflight/OPTIONS request. In chrome I don't see the allow-origins header on for the options request and the console says the header is missing but I know for a fact that I send it. So I don't understand why the 401?? Oh, and all GET requests work just fine, it's the preflight with OPTIONS that get the 401.. Anyone has any idea about how to solve it?
@kpg7882
@kpg7882 3 месяца назад
That minimal api apps are very confusing - I'm missing the part where OtherApp is calling an API. EDIT: Nvm - fetching a server app from otherapp console does this.
@Per-vh5ex
@Per-vh5ex Год назад
First 😄
Далее
Understanding .NET C# Heaps (Deep Dive)
28:23
Просмотров 12 тыс.
C# Async Await Mistakes | Part 1
10:19
Просмотров 31 тыс.
The Trump rally shooting from a photographer's POV
00:58
Why replace if statements with Objects
22:20
Просмотров 8 тыс.
azure devops python api
1:53
Просмотров 385
What you should know about Threads in .NET
14:52
Просмотров 7 тыс.
Brutally honest advice for new .NET Web Developers
7:19