Answer the question
In order to leave comments, you need to log in
Trying to add a session to a project?
I'm trying to add a line to the session: HttpContext.Session.SetString("Train", "wewew");
In ConfigureServices I added:
services.AddDistributedMemoryCache();
services.AddSession();
app.UseAuthentication();
app.UseSession();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
An unhandled exception occurred while processing the request.
InvalidOperationException: Session has not been configured for this application or request.
Microsoft.AspNetCore.Http.DefaultHttpContext.get_Session()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question