I have a website that has been working for a while. Once I log in, it keeps me logged in for several weeks.
However, I’ve just moved to a new server. And now, every time I’m away from the computer for hours, I have to log in again.
Does anyone know what could cause this?
Below is my configuration code.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseMigrationsEndPoint();
}
else
{
app.UseExceptionHandler("/Error");
app.UseStatusCodePagesWithReExecute("/ErrorCode", "?code={0}");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
if (IsDemoSite)
{
app.UseHttpsRedirection();
}
else
{
RewriteOptions options = new RewriteOptions()
.AddRedirectToHttpsPermanent()
.AddRedirectToWwwPermanent();
app.UseRewriter(options);
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers(); // For Railtrax API
endpoints.MapRazorPages();
});
}