裕隆城折扣合作@中興低碳 折扣報表
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using CouponReport.Models.CouponMiddleware;
  2. using CouponReport.Models.Parkingeyes;
  3. using CouponReport.Service;
  4. using LaneFlowReport.Auth;
  5. using LaneFlowReport.Options;
  6. using Microsoft.AspNetCore.Authentication.Cookies;
  7. using Microsoft.EntityFrameworkCore;
  8. var builder = WebApplication.CreateBuilder(args);
  9. builder.Services.AddHttpClient();
  10. builder.Services.AddScoped<ReportService>();
  11. builder.Services.AddSingleton<ParkingAuthProvider>();
  12. builder.Services.Configure<OauthOption>(builder.Configuration.GetSection("Authentication:Parking"));
  13. builder.Services.AddDbContext<CouponMiddlewareContext>(options =>
  14. options.UseSqlServer(builder.Configuration.GetConnectionString("myConnection")));
  15. builder.Services.AddDbContext<ParkingEyesContext>(options =>
  16. options.UseSqlServer(builder.Configuration.GetConnectionString("ParkingEyesConnection")));
  17. builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
  18. .AddCookie(options =>
  19. {
  20. options.LoginPath = "/Home/Index";
  21. options.AccessDeniedPath = "/Home/Index";
  22. options.Cookie.HttpOnly = true;
  23. options.Cookie.IsEssential = true;
  24. options.Cookie.SameSite = SameSiteMode.Strict;
  25. options.SlidingExpiration = true;
  26. options.Cookie.Expiration = null;
  27. });
  28. // Add services to the container.
  29. builder.Services.AddControllersWithViews();
  30. builder.Services.AddSession(options =>
  31. {
  32. options.Cookie.HttpOnly = true;
  33. options.Cookie.IsEssential = true;
  34. });
  35. var app = builder.Build();
  36. // Configure the HTTP request pipeline.
  37. if (!app.Environment.IsDevelopment())
  38. {
  39. app.UseExceptionHandler("/Home/Error");
  40. app.UseHsts();
  41. }
  42. app.UseHttpsRedirection();
  43. app.UseStaticFiles();
  44. app.UseRouting();
  45. app.UseSession();
  46. app.UseAuthentication();
  47. app.UseAuthorization();
  48. app.MapControllerRoute(
  49. name: "default",
  50. pattern: "{controller=Home}/{action=Index}/{id?}");
  51. app.Run();