Skip to content

Commit 3377187

Browse files
989384: Solving the authorization issue
1 parent ae06a4e commit 3377187

File tree

1 file changed

+5
-7
lines changed
  • ASPCore-FileManager-WebAPI/ASPCore-FileManager-WebAPI

1 file changed

+5
-7
lines changed

ASPCore-FileManager-WebAPI/ASPCore-FileManager-WebAPI/Program.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
// Add services to the container.
88
builder.Services.AddRazorPages();
9+
builder.Services.AddControllers();
910
builder.Services.AddCors(options =>
1011
{
11-
options.AddPolicy("AllowAllOrigins", builder =>
12+
options.AddPolicy("AllowAllOrigins", policy =>
1213
{
13-
builder.AllowAnyOrigin()
14+
policy.AllowAnyOrigin()
1415
.AllowAnyMethod()
1516
.AllowAnyHeader();
1617
});
@@ -41,13 +42,10 @@
4142
app.UseStaticFiles();
4243

4344
app.UseRouting();
45+
app.UseCors("AllowAllOrigins");
4446
app.UseAuthentication();
4547
app.UseAuthorization();
4648

49+
app.MapControllers();
4750
app.MapRazorPages();
48-
app.UseCors("AllowAllOrigins");
49-
app.UseEndpoints(endPoints =>
50-
{
51-
endPoints.MapControllers();
52-
});
5351
app.Run();

0 commit comments

Comments
 (0)