protected void Application_Start()
        {
            // This is a *partial* fix for some of the issues discovered when disabling TLS 1.0 as part of the following story: https://projects.sitkatech.com/projects/gemini/cards/4197
            // Allow multiple protocols so that we can connect to more than one endpoint, over time we may need to add Tls13 etc
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;

            SitkaLogger.RegisterLogger(new FirmaLogger());

            // this needs to match the Area Name declared in the Areas folder

            // create the default routes for the app and the areas
            var defaultRoutes =
                AreasDictionary.Select(
                    keyValuePair =>
                    new SitkaRouteTableEntry(string.Format("{0}_Default", keyValuePair.Key),
                                             String.Empty,
                                             string.Format("ProjectFirma.Web{0}.Controllers", !string.IsNullOrWhiteSpace(keyValuePair.Key) ? string.Format(".Areas.{0}", keyValuePair.Key) : string.Empty),
                                             SitkaController.DefaultController,
                                             SitkaController.DefaultAction,
                                             keyValuePair.Key,
                                             keyValuePair.Value,
                                             null,
                                             false)).ToList();

            var viewLocations = new ViewEngineLocations {
                PartialViewLocations = new List <string>
                {
                    "~/Views/Shared/TextControls/{0}.cshtml",
                    "~/Views/Shared/ExpenditureAndBudgetControls/{0}.cshtml",
                    "~/Views/Shared/PerformanceMeasureControls/{0}.cshtml",
                    "~/Views/Shared/ProjectControls/{0}.cshtml",
                    "~/Views/Shared/ProjectLocationControls/{0}.cshtml",
                    "~/Views/Shared/ProjectGeospatialAreaControls/{0}.cshtml",
                    "~/Views/Shared/ProjectUpdateDiffControls/{0}.cshtml",
                    "~/Views/Shared/ProjectOrganization/{0}.cshtml",
                    "~/Views/Shared/ProjectPerson/{0}.cshtml",
                    "~/Views/Shared/SortOrder/{0}.cshtml",
                    "~/Views/Shared/ProjectDocument/{0}.cshtml",
                    "~/Views/Shared/UserStewardshipAreas/{0}.cshtml",
                    "~/Views/Shared/FileResourceControls/{0}.cshtml",
                }
            };

            // read the log4net configuration from the web.config file
            XmlConfigurator.Configure();

            Logger.InfoFormat("Application Start{0}{1} version: {2}{0}Compiled: {3:MM/dd/yyyy HH:mm:ss}{0}"
                              , Environment.NewLine
                              , "ProjectFirma"
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.ApplicationVersion
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.DateCompiled
                              );

            RouteTableBuilder.Build(FirmaBaseController.AllControllerActionMethods, defaultRoutes, AreasDictionary);
            SetupCustomViewLocationsForTemplates(viewLocations, AreasDictionary);
            ModelBinders.Binders.DefaultBinder = new SitkaDefaultModelBinder();

            RegisterGlobalFilters(GlobalFilters.Filters);
            FluentValidationModelValidatorProvider.Configure();
        }
示例#2
0
        protected void Application_Start()
        {
            SitkaLogger.RegisterLogger(new FirmaLogger());

            // this needs to match the Area Name declared in the Areas folder

            // create the default routes for the app and the areas
            var defaultRoutes =
                AreasDictionary.Select(
                    keyValuePair =>
                    new SitkaRouteTableEntry(string.Format("{0}_Default", keyValuePair.Key),
                                             String.Empty,
                                             $"ProjectFirma.Web{(!string.IsNullOrWhiteSpace(keyValuePair.Key) ? $".Areas.{keyValuePair.Key}" : string.Empty)}.Controllers",
                                             SitkaController.DefaultController,
                                             SitkaController.DefaultAction,
                                             keyValuePair.Key,
                                             keyValuePair.Value,
                                             null,
                                             false)).ToList();

            var viewLocations = new ViewEngineLocations {
                PartialViewLocations = new List <string>
                {
                    "~/Views/Shared/TextControls/{0}.cshtml",
                    "~/Views/Shared/ExpenditureAndBudgetControls/{0}.cshtml",
                    "~/Views/Shared/PerformanceMeasureControls/{0}.cshtml",
                    "~/Views/Shared/ProjectControls/{0}.cshtml",
                    "~/Views/Shared/ProjectLocationControls/{0}.cshtml",
                    "~/Views/Shared/ProjectGeospatialAreaControls/{0}.cshtml",
                    "~/Views/Shared/ProjectUpdateDiffControls/{0}.cshtml",
                    "~/Views/Shared/ProjectOrganization/{0}.cshtml",
                    "~/Views/Shared/ProjectContact/{0}.cshtml",
                    "~/Views/Shared/SortOrder/{0}.cshtml",
                    "~/Views/Shared/ProjectDocument/{0}.cshtml",
                    "~/Views/Shared/ProjectAttachment/{0}.cshtml",
                    "~/Views/Shared/UserStewardshipAreas/{0}.cshtml",
                }
            };

            // read the log4net configuration from the web.config file
            XmlConfigurator.Configure();

            Logger.InfoFormat("Application Start{0}{1} version: {2}{0}Compiled: {3:MM/dd/yyyy HH:mm:ss}{0}"
                              , Environment.NewLine
                              , "ProjectFirma"
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.ApplicationVersion
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.DateCompiled
                              );

            RouteTableBuilder.Build(FirmaBaseController.AllControllerActionMethods, defaultRoutes, AreasDictionary);
            SetupCustomViewLocationsForTemplates(viewLocations, AreasDictionary);
            ModelBinders.Binders.DefaultBinder = new SitkaDefaultModelBinder();

            RegisterGlobalFilters(GlobalFilters.Filters);
            FluentValidationModelValidatorProvider.Configure();

            //FederatedAuthentication.ServiceConfigurationCreated += FederatedAuthentication_ServiceConfigurationCreated;
        }
示例#3
0
        protected void Application_Start()
        {
            SitkaLogger.RegisterLogger(new NeptuneLogger());
            CookiePrefixToExcludeFromEmailLogging = $"{NeptuneWebConfiguration.KeystoneOpenIDClientId}_";

            // this needs to match the Area Name declared in the Areas folder

            // create the default routes for the app and the areas
            var defaultRoutes =
                AreasDictionary.Select(
                    keyValuePair =>
                    new SitkaRouteTableEntry(string.Format("{0}_Default", keyValuePair.Key),
                                             String.Empty,
                                             string.Format("Neptune.Web{0}.Controllers", !string.IsNullOrWhiteSpace(keyValuePair.Key) ? string.Format(".Areas.{0}", keyValuePair.Key) : string.Empty),
                                             SitkaController.DefaultController,
                                             SitkaController.DefaultAction,
                                             keyValuePair.Key,
                                             keyValuePair.Value,
                                             null,
                                             false)).ToList();

            var viewLocations = new ViewEngineLocations {
                PartialViewLocations = new List <string>
                {
                    "~/Views/Shared/TextControls/{0}.cshtml",
                    "~/Views/Shared/ExpenditureAndBudgetControls/{0}.cshtml",
                    "~/Views/Shared/PerformanceMeasureControls/{0}.cshtml",
                    "~/Views/Shared/ProjectControls/{0}.cshtml",
                    "~/Views/Shared/JurisdictionControls/{0}.cshtml",
                    "~/Views/Shared/ProjectWatershedControls/{0}.cshtml",
                    "~/Views/Shared/ProjectUpdateDiffControls/{0}.cshtml",
                    "~/Views/Shared/EditAttributes/{0}.cshtml",
                    "~/Views/Shared/SortOrder/{0}.cshtml",
                    "~/Views/Shared/Location/{0}.cshtml",
                    "~/Views/Shared/UserJurisdictions/{0}.cshtml",
                    "~/Views/Shared/HRUCharacteristics/{0}.cshtml",
                    "~/Views/Shared/ModeledPerformance/{0}.cshtml",
                    "~/Views/FieldVisit/ObservationTypePreview/{0}.cshtml",
                }
            };

            // read the log4net configuration from the web.config file
            XmlConfigurator.Configure();

            Logger.InfoFormat("Application Start{0}{1} version: {2}{0}Compiled: {3:MM/dd/yyyy HH:mm:ss}{0}"
                              , Environment.NewLine
                              , "Neptune"
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.ApplicationVersion
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.DateCompiled
                              );

            RouteTableBuilder.Build(NeptuneBaseController.AllControllerActionMethods, defaultRoutes, AreasDictionary);
            SetupCustomViewLocationsForTemplates(viewLocations, AreasDictionary);
            ModelBinders.Binders.DefaultBinder = new SitkaDefaultModelBinder();

            RegisterGlobalFilters(GlobalFilters.Filters);
            FluentValidationModelValidatorProvider.Configure();
        }