Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 1576592

Browse files
committed
Documentazione Policy Cors closes #35
1 parent d97f60a commit 1576592

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Policy CORS (Cross-Origin Resource Sharing) configuration
2+
3+
4+
## Registering services at Startup
5+
6+
```csharp
7+
public Startup(IConfiguration configuration)
8+
{
9+
Configuration = configuration;
10+
}
11+
12+
public IConfiguration Configuration { get; }
13+
14+
public void ConfigureServices(IServiceCollection services)
15+
{
16+
services.AddControllers();
17+
services.AddPolicyCors(myPolicyName);
18+
//OR services.AddFullPolicyCors(myPolicyName); //If you want to add all the CORS configuration options
19+
20+
//OMISSIS
21+
}
22+
23+
public void Configure(WebApplication app)
24+
{
25+
//OMISSIS
26+
27+
app.UseCors(myPolicyName);
28+
29+
//OMISSIS
30+
}
31+
```
32+
33+
<b>Note:</b> The myPolicyName indicates in string format the name of the policy to be assigned to the CORS configuration.

0 commit comments

Comments
 (0)