Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IDistributeCacheRepository cache)
        {
            // Set cache when starting service
            var currentTimeUTC = DateTime.UtcNow.ToString();

            cache.UpSert("cachedTimeUTC", currentTimeUTC);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
            }

            // app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseStaticFiles();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
            });
        }
Exemplo n.º 2
0
        public IActionResult OnPostResetCachedTime()
        {
            var currentTimeUTC = DateTime.UtcNow.ToString();

            _cache.UpSert("cachedTimeUTC", currentTimeUTC);

            return(RedirectToPage());
        }