24 lines
726 B
C#
24 lines
726 B
C#
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace HRD.WebApi.Helpers
|
|
{
|
|
public static class CorsExtension
|
|
{
|
|
public static void AddCustomCors(this IServiceCollection services, string policyName)
|
|
{
|
|
services.AddCors(options =>
|
|
{
|
|
options.AddPolicy(policyName,
|
|
builder =>
|
|
{
|
|
builder
|
|
.AllowCredentials()
|
|
//.AllowAnyOrigin()
|
|
.SetIsOriginAllowed(origin => true)
|
|
.AllowAnyHeader()
|
|
.AllowAnyMethod();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
} |