C
C#Saba Jangidze

❔ CORS error

Hello, I have Cors error on my project. I add Addpolicy in my configureServices and also add app.UseCors() in configure but I have same error. Does anyone know how to fix it and where do I have Problem? code below:
MW
Monsieur Wholesome512d ago
Take a look at your network tab and see what origin header it uses in the failed request And copy that 1:1 to your policy
SJ
Saba Jangidze512d ago
I used "*" but it doesn't work
F
FusedQyou512d ago
Remove the trailing / Right now you set up the whole host rather than the origin. Pretty confusing, but https://localhost:44389 is your origin, rather than https://localhost:44389/
SJ
Saba Jangidze512d ago
Doesn't work
F
FusedQyou512d ago
That's because you're missing information. I suppose your error has changed?
SJ
Saba Jangidze512d ago
what do you mean? Tell me what is wrong in my code
F
FusedQyou512d ago
Do you have a different error?
SJ
Saba Jangidze512d ago
No
F
FusedQyou512d ago
Does your build app have useCors() defined?
SJ
Saba Jangidze512d ago
F
FusedQyou512d ago
The error specifies you're loading a resource from a different origin
SJ
Saba Jangidze512d ago
I think this error comes from front end because with svg's link I can open image
F
FusedQyou512d ago
I actually misread the error myself and didn't realise it was a whole different url in the first place Is the svg located on a website you own? Is it your published server? The error comes from the frontend because it's attempting to fetch something that it is not allowed to fetch, because that svg is located on a website that doesn't have CORS configured to allow it to be fetched
SJ
Saba Jangidze512d ago
It is published server
F
FusedQyou512d ago
What if you add .AllowAnyHeader().AllowAnyMethod() to your cors configuration?
SJ
Saba Jangidze512d ago
it does not work I have only one idea to change something in html code
F
FusedQyou512d ago
AllowANyOrigin()? This is a problem with your server though
SJ
Saba Jangidze512d ago
Same 😄
F
FusedQyou512d ago
Not the frontend Does your published server also have this??
SJ
Saba Jangidze512d ago
maybe but I cant fix it because it is for devops
F
FusedQyou512d ago
Does the published server maybe use a different origin altogether because it's published?
SJ
Saba Jangidze512d ago
Ya
F
FusedQyou512d ago
Well, it should work if it knows the proper origin. I am not sure what would cause it to not work now.
SJ
Saba Jangidze512d ago
I can use this image in my admin panel but it does not work on main web
A
Accord511d 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
More Posts
❔ Ambiguities? How?Idk how i can resolve this i don't see the problem✅ How can I get rid of this annoying pointer thing in the first row, datagridview winforms^✅ How can I use a row header of a datagridview to display the row number instead of being empty?^✅ How can i properly display this datagridviewHow can i get rid of the row select thing on the left (just white space)✅ I am trying to output a 2D array to a datagridview, but it is not outputting correctlyIt is saying System.Int32[]✅ Task not returning and stopping programHey, I am currently trying to start one task for every string in the list, but this isn't working an❔ DbContextCan i use this in a non-asp area like for example, a simple program to make few tables using DbSet✅ The specified deps.json does not exist while scaffolding DBI am going through a tutorial to create a Web API app with ASP.NET6 and MySql. I wanted to scaffold ❔ C sharp object reference errorI am trying to reference an object that I'm displaying on PageHeader.xaml and I keep getting this erInteroperability issues (PInvoke)Hi! I'm calling a native CPP library and retrieving a struct by reference which returns a struct con❔ SKIA SHARP PROBLEMError: ```cmd Dec 02 16:05:22 mourashop shopmoura-api-app[3847595]: Unhandled exception. System.Argu❔ FluentAssertions excluding collection elementsI have two IEnumerable<Claim> tmp1, tmp2 and I want to see if they are equal, except for the claims ✅ Best way to display a 2D arrayWhat would be the best way to display a 2D array in winforms c#, with the best design, or is just prWrong count for my inversions functionIt is supposed to be 10 inversion count but I am getting 13 ```csharp var array = new int✅ Need some help with classesNot too sure how to correctly use attributes from a class in a class function✅ Type CastingHi, Just wondering how I would type cast the object 'control' to the type 'telerikslider'?❔ Mocking with EntityFrameworkCoreHm, I'm creating unit tests for a class that has a `private readonly MyDbContext dbContext;` that ca❔ How to use BeginTransaction in repository from infrastructureI have this code in CommandHandler (Application layer): ``` using var transaction = _ProductReposito✅ EXE from MAUII made a program with MAUI. It runs with VS fine, but now I want to install this program on another ❔ Refactor help`Can this be written as a Linq expression? I've been trying but I keep failing at it. I'm not as grea