Answers for "asp.net core allow all origins"

C#
5

asp.net core allow all origins

public void ConfigureServices(IServiceCollection services)
{
    services.AddCors(options =>
    {
        options.AddPolicy(MyAllowSpecificOrigins,
        builder =>
        {
            builder.WithOrigins("http://example.com",
                                "http://www.contoso.com")
                                .AllowAnyHeader()
                                .AllowAnyMethod();
        });
    });

    services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}
Posted by: Guest on March-03-2020

Code answers related to "asp.net core allow all origins"

C# Answers by Framework

Browse Popular Code Answers by Language