C
C#2y ago
bstar6248

❔ !CORS ERROR!

Hi Everybody, I am working on one project that frontend is React and Backend is C# in this project, I faced with CORS err, how can I solve this problem?
31 Replies
Kouhai
Kouhai2y ago
How did you enable CORS on your C# backend?
bstar6248
bstar6248OP2y ago
dont know when I receive data from backend side to react, this error is occurred, I think.. do you have any experience with that?
Kouhai
Kouhai2y ago
You have to enable CORS in your ASP.NET api
Kouhai
Kouhai2y ago
Enable Cross-Origin Requests (CORS) in ASP.NET Core
Learn how CORS as a standard for allowing or rejecting cross-origin requests in an ASP.NET Core app.
bstar6248
bstar6248OP2y ago
eh... I didnt use ASP.NET for my backend api i will share screen shot
bstar6248
bstar6248OP2y ago
bstar6248
bstar6248OP2y ago
bstar6248
bstar6248OP2y ago
bstar6248
bstar6248OP2y ago
these are some screen shots of my backend side
Pobiega
Pobiega2y ago
This looks like a .NET framework project. Is that intentional, and if so, why?
bstar6248
bstar6248OP2y ago
Yes, this is .NET Framework Project... eh, nothing special for reason.. I just wanted to make backend side using .Net could you give me some help?
Pobiega
Pobiega2y ago
.NET framework is legacy, outdated you should be using .NET 7
bstar6248
bstar6248OP2y ago
I used .Net 4.5.1... to be honest, I dont have any exp or knowledge about ASP .NET
Pobiega
Pobiega2y ago
okay. well you are using a version that is from... 2015? or so you really should be using .NET 7, which is the current latest version of .NET
Pobiega
Pobiega2y ago
Pobiega
Pobiega2y ago
I will gladly help you, if you embrace the modern side of .NET and use .NET 7 with ASP.NET Core and EF Core.
bstar6248
bstar6248OP2y ago
okay, thanks
Pobiega
Pobiega2y ago
it looks like you already have visual studio 2022 installed, so you likely have .net 6 or 7 too if you can just run dotnet --info in a terminal and show me the result...
bstar6248
bstar6248OP2y ago
yes, will do just a sec
bstar6248
bstar6248OP2y ago
Pobiega
Pobiega2y ago
okay that is.. old. so that wasnt visual studio 2022 I saw?
bstar6248
bstar6248OP2y ago
2019.. lol...
Pobiega
Pobiega2y ago
Ok, you'll need to update
bstar6248
bstar6248OP2y ago
eh, is there any way without updating?
Pobiega
Pobiega2y ago
well, not with using visual studio. Why are you so adverse to updating?
bstar6248
bstar6248OP2y ago
actually, my pc is not so good.. so it will take a long time when i update I'd like to solve this problem asap
Jimmacle
Jimmacle2y ago
2013 it's as old as react
Pobiega
Pobiega2y ago
Well, as I said... I'm not here to fix your CORS issue as such Im here to make you recreate your project from scratch on a modern .NET version If you want to use a 2013 version that went out of support in 2016, that is your call.. but noone will want to touch that with a 40 foot pole
Jimmacle
Jimmacle2y ago
you're setting yourself up for more problems than just waiting a while to update software on your PC
bstar6248
bstar6248OP2y ago
oh, yes...
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server