public void Save(string sessionKey, IDictionary <string, object> sessionState) { if (!_directory.Exists(_path)) { _directory.Create(_path); } var sessionFilename = Path.Combine(_path, sessionKey); var bytes = _sessionStateSerializer.Serialize(sessionState); _file.WriteAllBytes(sessionFilename, bytes); }
public byte[] Serialize(IDictionary <string, object> sessionState) { var unprotectedBytes = _innerSessionStateSerializer.Serialize(sessionState); return(ProtectedData.Protect(unprotectedBytes, _additionalEntropy, DataProtectionScope.CurrentUser)); }