Interface used by all objects implementing per-user session persistence.
| C# | Visual Basic | Visual C++ |
public interface ISessionPersistence
Public Interface ISessionPersistence
public interface class ISessionPersistence
| All Members | Properties | ||||
| Icon | Member | Description |
|---|---|---|
| Nonce |
Gets or sets the nonce value used to protect against replay attacks.
|
Implementing the ISessionPersistence interface just requires implementing the Cnonce property. When the property is set, it must be persisted immediately.
The following code persists to the ASP.NET Session object.
public class SessionSessionManager : ISessionPersistence { const string cnoncestr = "AllowLogin"; #region ISessionPersistence Members public int Cnonce { get { if (HttpContext.Current.Session[cnoncestr] == null) { return -1; } return (int)HttpContext.Current.Session[cnoncestr]; } set { HttpContext.Current.Session[cnoncestr] = value; } } #endregion }