.NetCore跨域

 

 

  "App":  {
  "CorsOrigins": "http://manage.l.cn,http://www..cn,https://www.lu.cn,,http://u.cn,https://portal.edu.cn"
  },

 

 

  services.AddCors(options =>
            {
                options.AddPolicy("localhost", builder =>
                {
                    //App:CorsOrigins in appsettings.json can contain more than one address with splitted by comma.
                    builder
                        .WithOrigins(
                            // App:CorsOrigins in appsettings.json can contain more than one address separated by comma.
                            _appConfiguration["App:CorsOrigins"]
                                .Split(",", StringSplitOptions.RemoveEmptyEntries)
                                .Select(o => o.RemovePostFix("/"))
                                .ToArray()
                        )
                        .SetIsOriginAllowedToAllowWildcardSubdomains()
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        .AllowCredentials();
                });
            });

 

.NetCore跨域

上一篇:JQuery选择器


下一篇:j2ee规范——JDBC