0

Is there a way to access session variables in global.asax? I have a timer function set in Application_Start(), but for which I'm in need to access my user credentials which I stored after login. But I can't seem to access the session storage here. Any idea why I can't or any other way to store and access user data in global.asax would be helpful.

Uzair Khan
  • 2,812
  • 7
  • 30
  • 48

1 Answers1

0

I assume that you use the Identity Framework. You can read here how to access Session Data: https://stackoverflow.com/a/1164629 This is how you can just access the Database via the ApplicationDbContext:

var UsersContext = new ApplicationDbContext();
List<ApplicationUser> = UsersContext.Users.toList()
Community
  • 1
  • 1
Larce
  • 841
  • 8
  • 17