22 lines
550 B
C#
22 lines
550 B
C#
using System;
|
|
using Microsoft.AspNet.Builder;
|
|
using Microsoft.AspNet.Http;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace UseOptions
|
|
{
|
|
public class Startup
|
|
{
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddCors(options =>
|
|
options.AddPolicy("allowSingleOrigin", builder => builder.WithOrigins("http://example.com")));
|
|
}
|
|
|
|
public void Configure(IApplicationBuilder app)
|
|
{
|
|
app.UseCors("allowSingleOrigin");
|
|
}
|
|
}
|
|
}
|