You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm raising this because I spent hours and hours down Machine Key related rabbit holes and am hoping to save anyone else the joy of that :)
The long and short of it is that:
AppId isn't settable via any config option, it only ever uses the static HttpRuntime.AppDomainAppId
GetHashCode doesn't always return the same value for a given string so even if you set HttpRuntime.AppDomainAppId via reflection, the value from GetHashCode() still changes.
I'm not sure what the proper resolution is but setting HttpRuntime.AppDomainAppId (via reflection) at start up and just appending the AppId string without the call to GetHashCode.ToString(X8) means that the session id doesn't change across slot swaps.
Happy to provide any other info if needed.
The text was updated successfully, but these errors were encountered:
robs
linked a pull request
Jul 21, 2023
that will
close
this issue
I'm raising this because I spent hours and hours down Machine Key related rabbit holes and am hoping to save anyone else the joy of that :)
The long and short of it is that:
This is where the session id is suffixed with HttpRuntime.AppDomainAppId.GetHashCode().ToString("X8", CultureInfo.InvariantCulture)
https://github.com/aspnet/AspNetSessionState/blob/06de5f5270c6d9b7d7f6bd1a0bc6343b8c0a56f5/src/SqlSessionStateProviderAsync/SqlSessionStateProviderAsync.cs#L128C77-L128C77
I'm not sure what the proper resolution is but setting HttpRuntime.AppDomainAppId (via reflection) at start up and just appending the AppId string without the call to GetHashCode.ToString(X8) means that the session id doesn't change across slot swaps.
Happy to provide any other info if needed.
The text was updated successfully, but these errors were encountered: