using System.Collections.Generic; using System.Text; using System.Text.Json.Serialization; using ASC.Api.Core; using ASC.Common; using ASC.CRM.Api; using ASC.CRM.ApiModels; using ASC.CRM.HttpHandlers; using ASC.CRM.Mapping; using ASC.Web.CRM.Core.Search; using ASC.Web.CRM.HttpHandlers; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace ASC.CRM { public class Startup : BaseStartup { public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment) : base(configuration, hostEnvironment) { } public override void ConfigureServices(IServiceCollection services) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); base.ConfigureServices(services); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); } public override void Configure(IApplicationBuilder app, IWebHostEnvironment env) { base.Configure(app, env); app.UseMiddleware(); app.MapWhen( context => context.Request.Path.ToString().EndsWith("httphandlers/contactphotohandler.ashx"), appBranch => { appBranch.UseContactPhotoHandler(); }); app.MapWhen( context => context.Request.Path.ToString().EndsWith("httphandlers/filehandler.ashx"), appBranch => { appBranch.UseFileHandler(); }); app.MapWhen( context => context.Request.Path.ToString().EndsWith("httphandlers/fileuploaderhandler.ashx"), appBranch => { appBranch.UseFileUploaderHandler(); }); app.MapWhen( context => context.Request.Path.ToString().EndsWith("httphandlers/importfilehandler.ashx"), appBranch => { appBranch.UseImportFileHandlerHandler(); }); app.MapWhen( context => context.Request.Path.ToString().EndsWith("httphandlers/organisationlogohandler.ashx"), appBranch => { appBranch.UseOrganisationLogoHandler(); }); app.MapWhen( context => context.Request.Path.ToString().EndsWith("httphandlers/webtoleadfromhandler.ashx"), appBranch => { appBranch.UseWebToLeadFromHandlerHandler(); }); } public override JsonConverter[] Converters { get { var jsonConverters = new List { new ContactDtoJsonConverter() }; return jsonConverters.ToArray(); } } } }