0

I am using handy information from HttpContext and ClaimsIdentity in AppDomain memory of a LoadBalanced Server. It is not accesible on the other LoadBalanced Servers even if Session is stored in outProc/SqlServer.
Below is the MVC.Net 5 code specific to each LoadBalanced Server:

@using Microsoft.AspNet.Identity
@using System.Security.Claims
@using ClaimTypes = System.IdentityModel.Claims.ClaimTypes

((ClaimsIdentity)User.Identity).FindFirstValue(ClaimTypes.GivenName)
@HttpContext.Current.User.IsInRole("RoleName")

I know there are other ways to access RoleName and GivenName (like getting from DB). But is there any way to share this handy info (HttpContext.Current.User and User.Identity) across LoadBalanced Servers? If not, what is the best way to share this info across LoadBalanced Servers?

Mahen
  • 3
  • 5
  • Looks like It is due to machine key missing in the webconfig files of the loadbalanced servers. I will confirm soon. – Mahen Aug 02 '20 at 05:10

1 Answers1

0

Entering MachineKey in the webconfig of load balanced servers solved the problem.

Mahen
  • 3
  • 5