AppDomain handy information lost in load balanced scenario

49 views Asked by At

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?

1

There are 1 answers

0
Mahen On

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