Skip to content

Commit

Permalink
FileUrlConstraint
Browse files Browse the repository at this point in the history
  • Loading branch information
Soar360 committed May 20, 2024
1 parent f0f8042 commit 18fc6e5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions EasyWeb/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
app.UseAuthorization();
app.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");

//app.MapControllerRoute(
// name: "File",
// pattern: "{*file}",
// defaults: new { controller = "Home", action = "DownloadFile" },
// constraints: new { file = new FileUrlConstraint() }
//);
app.MapControllerRoute(
name: "File",
pattern: "{*file}",
defaults: new { controller = "Home", action = "DownloadFile" },
constraints: new { file = app.Services.GetRequiredService<FileUrlConstraint>() }
);

// 注册退出事件
if (app is IHost host)
Expand Down

0 comments on commit 18fc6e5

Please sign in to comment.