0

Error: CS0103: The name Session does not exist in the current context

I want to use sessions in my web application to check if user is logged in.

Here is the controller:

controller

I have also added the services in program.cs file but that doesn't seem to work either.

This is my program.cs:

program

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

2 Answers2

0

You need to add the reference to this dll Microsoft.AspNetCore.Session, then it should work.

Ajay Managaon
  • 450
  • 2
  • 9
0

I was trying to call HttpContent.Session but it was HttpContext.Session. Thank you for the support