-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
42 lines (39 loc) · 944 Bytes
/
Copy pathProgram.cs
File metadata and controls
42 lines (39 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Diagnostics;
try
{
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllersWithViews().AddSessionStateTempDataProvider();
builder.Services.AddSession();
WebApplication app = builder.Build();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseDefaultFiles();
app.UseRouting();
app.UseSession();
app.MapDefaultControllerRoute();
app.Use(async (context, next) =>
{
try
{
if(context.Request.Path.ToString().Contains("favicon.ico") == true)
{
context.Response.StatusCode = StatusCodes.Status200OK;
}
else
{
await next();
}
}
catch(Exception e)
{
Debug.WriteLine(e);
throw e;
}
});
app.Run();
}
catch(Exception e)
{
Debug.WriteLine(e);
throw e;
}