Click here to Skip to main content
15,849,182 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource Pin
jkirkerx15-Oct-19 14:54
professionaljkirkerx15-Oct-19 14:54 
AnswerRe: has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource Pin
F-ES Sitecore15-Oct-19 23:14
professionalF-ES Sitecore15-Oct-19 23:14 
AnswerRe: has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource Pin
simpledeveloper16-Oct-19 8:10
simpledeveloper16-Oct-19 8:10 
Hi, thank you I could able to resolve this issue by implementing CORS on my Web API, here is the Code change I did in my Web API. Thank you for all the support you Geeks have given me - thanks for the help
public void ConfigureServices(IServiceCollection services)
    {
        string configValue = Configuration.GetValue<string>("CORSComplianceDomains");
        string[] CORSComplianceDomains = configValue.Split("|,|");

        services.AddCors(options =>
        {
            options.AddDefaultPolicy(
                builder =>
                {

                    builder.WithOrigins("http://localhost:3000");
                });

            options.AddPolicy("AnotherPolicy",
                builder =>
                {
                    builder.WithOrigins(CORSComplianceDomains)
                                        .AllowAnyHeader()
                                        .AllowAnyMethod();
                });

        });

        services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

        // In production, the React files will be served from this directory
        services.AddSpaStaticFiles(configuration =>
        {
            configuration.RootPath = "ClientApp/build";
        });
    }

And added the urls in the appsettings.json file so that any user can add the new urls without much sweating.
"CORSComplianceDomains": "http://localhost:3000|,|http://www.contoso.com"

Thank you very much - I put my answer here so that someone can get it - thanks for jumping in and helping please - I appreciated it - thank you so much.
QuestionTrying to download Zip files that's returned from Api React Pin
simpledeveloper14-Oct-19 10:00
simpledeveloper14-Oct-19 10:00 
AnswerRe: Trying to download Zip files that's returned from Api React Pin
Richard Deeming14-Oct-19 10:38
mveRichard Deeming14-Oct-19 10:38 
GeneralRe: Trying to download Zip files that's returned from Api React Pin
simpledeveloper14-Oct-19 12:45
simpledeveloper14-Oct-19 12:45 
GeneralRe: Trying to download Zip files that's returned from Api React Pin
Richard Deeming15-Oct-19 2:24
mveRichard Deeming15-Oct-19 2:24 
GeneralRe: Trying to download Zip files that's returned from Api React Pin
simpledeveloper15-Oct-19 7:31
simpledeveloper15-Oct-19 7:31 
GeneralRe: Trying to download Zip files that's returned from Api React Pin
simpledeveloper15-Oct-19 9:59
simpledeveloper15-Oct-19 9:59 
GeneralRe: Trying to download Zip files that's returned from Api React Pin
Richard Deeming16-Oct-19 8:49
mveRichard Deeming16-Oct-19 8:49 
GeneralRe: Trying to download Zip files that's returned from Api React Pin
simpledeveloper17-Oct-19 7:53
simpledeveloper17-Oct-19 7:53 
GeneralRe: Trying to download Zip files that's returned from Api React Pin
Richard Deeming17-Oct-19 8:12
mveRichard Deeming17-Oct-19 8:12 
GeneralRe: Trying to download Zip files that's returned from Api React Pin
simpledeveloper17-Oct-19 12:40
simpledeveloper17-Oct-19 12:40 
GeneralRe: Trying to download Zip files that's returned from Api React Pin
Richard Deeming18-Oct-19 2:12
mveRichard Deeming18-Oct-19 2:12 
GeneralRe: Trying to download Zip files that's returned from Api React Pin
simpledeveloper20-Oct-19 15:38
simpledeveloper20-Oct-19 15:38 
GeneralRe: Trying to download Zip files that's returned from Api React Pin
simpledeveloper21-Oct-19 9:08
simpledeveloper21-Oct-19 9:08 
GeneralRe: Trying to download Zip files that's returned from Api React Pin
simpledeveloper21-Oct-19 11:09
simpledeveloper21-Oct-19 11:09 
AnswerRe: Trying to download Zip files that's returned from Api React Pin
simpledeveloper21-Oct-19 9:10
simpledeveloper21-Oct-19 9:10 
QuestionAppending an Array of strings is giving me objects instead of strings separated with commas, my code and results are as below Pin
simpledeveloper14-Oct-19 7:32
simpledeveloper14-Oct-19 7:32 
AnswerRe: Appending an Array of strings is giving me objects instead of strings separated with commas, my code and results are as below Pin
Richard Deeming14-Oct-19 8:32
mveRichard Deeming14-Oct-19 8:32 
GeneralRe: Appending an Array of strings is giving me objects instead of strings separated with commas, my code and results are as below Pin
simpledeveloper14-Oct-19 9:18
simpledeveloper14-Oct-19 9:18 
QuestionCalling Api post method on button click in React Pin
simpledeveloper10-Oct-19 13:11
simpledeveloper10-Oct-19 13:11 
AnswerRe: Calling Api post method on button click in React Pin
jkirkerx10-Oct-19 14:40
professionaljkirkerx10-Oct-19 14:40 
GeneralRe: Calling Api post method on button click in React Pin
simpledeveloper10-Oct-19 16:18
simpledeveloper10-Oct-19 16:18 
QuestionI am trying to read from a Web api call and assign it to a state in React component Pin
simpledeveloper9-Oct-19 12:31
simpledeveloper9-Oct-19 12:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.