0

How do I add custom session data which can be accessed by an AngularJS SPA? I tried System.Web.HttpContext.Current.Session["AccountId"] but this threw an error indicating Session was null.

Note: AccountId in this case may or may not be a property of the User. Similar to a TenantId, a User's AccountId is nullable and users' without an AccountId set should be able to use any AccountId like impersonation.

ABP v3.3.0 and MVC v5.2.3

Thanks in advance!

Jacob Hulse
  • 839
  • 1
  • 10
  • 19
  • Possible duplicate of [How to add Username to AbpSession](https://stackoverflow.com/questions/48247269/how-to-add-username-to-abpsession) – Vivek Nuna Jan 19 '18 at 04:49
  • Similar but my use case cannot rely on User property alone. Some users need to be able to view any Account, not just one assigned to their User record. – Jacob Hulse Jan 19 '18 at 05:16
  • Can you describe your use case, and expected usage in C# code? – aaron Jan 19 '18 at 05:28
  • Use case is similar to TenantId crossed with User Impersonation. An Admin needs to be able to view data (query) across any AccountId while other users will be locked into only 1 account. When looking up account specific data, an account Id will be required for the query. – Jacob Hulse Jan 19 '18 at 05:43
  • Related: https://stackoverflow.com/questions/1382791/what-should-i-do-if-the-current-asp-net-session-is-null – aaron Jan 19 '18 at 07:10

0 Answers0