Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / State / ISessionStateStore.cs / 1 / ISessionStateStore.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
* SessionStateStoreProviderBase
*
*/
namespace System.Web.SessionState {
using System.Xml;
using System.Security.Permissions;
using System.Configuration.Provider;
using System.Collections.Specialized;
[FlagsAttribute()]
internal enum SessionStateItemFlags : int {
None = 0x00000000,
Uninitialized = 0x00000001,
IgnoreCacheItemRemoved = 0x00000002
}
[FlagsAttribute()]
public enum SessionStateActions : int {
None = 0x00000000,
InitializeItem = 0x00000001
}
// This interface is used by SessionStateModule to read/write the session state data
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public abstract class SessionStateStoreProviderBase : ProviderBase {
public abstract void Dispose();
// Called by SessionStateModule to notify the provider that Session_End is defined
// in global.asax, and so when an item expires, it should call the expireCallback
// If the provider does not support session expiry, it should return false.
public abstract bool SetItemExpireCallback(SessionStateItemExpireCallback expireCallback);
// Called at the beginning of the AcquireRequestState event
public abstract void InitializeRequest(HttpContext context);
// Get and return a SessionStateStoreData.
// Please note that we are implementing a reader/writer lock mechanism.
//
// If successful:
// - returns the item
//
// If not found:
// - set 'locked' to false
// - returns null
//
// If the item is already locked by another request:
// - set 'locked' to true
// - set 'lockAge' to how long has the item been locked
// - set 'lockId' to the context of the lock
// - returns null
public abstract SessionStateStoreData GetItem(HttpContext context,
String id,
out bool locked,
out TimeSpan lockAge,
out object lockId,
out SessionStateActions actions);
// Get and lock a SessionStateStoreData.
// Please note that we are implementing a reader/writer lock mechanism.
//
// If successful:
// - set 'lockId' to the context of the lock
// - returns the item
//
// If not found:
// - set 'locked' to false
// - returns null
//
// If the item is already locked by another request:
// - set 'locked' to true
// - set 'lockAge' to how long has the item been locked
// - set 'lockId' to the context of the lock
// - returns null
public abstract SessionStateStoreData GetItemExclusive(HttpContext context,
String id,
out bool locked,
out TimeSpan lockAge,
out object lockId,
out SessionStateActions actions);
// Unlock an item locked by GetExclusive
// 'lockId' is the lock context returned by previous call to GetExclusive
public abstract void ReleaseItemExclusive(HttpContext context,
String id,
object lockId);
// Write an item.
// Note: The item is originally obtained by GetExclusive
// Because SessionStateModule will release (by ReleaseExclusive) am item if
// it has been locked for too long, so it is possible that the request calling
// Set() may have lost the lock to someone else already. This can be
// discovered by comparing the supplied lockId with the lockId value
// stored with the state item.
public abstract void SetAndReleaseItemExclusive(HttpContext context,
String id,
SessionStateStoreData item,
object lockId,
bool newItem);
// Remove an item. See the note in Set.
public abstract void RemoveItem(HttpContext context,
String id,
object lockId,
SessionStateStoreData item);
// Reset the expire time of an item based on its timeout value
public abstract void ResetItemTimeout(HttpContext context, String id);
// Create a brand new SessionStateStoreData. The created SessionStateStoreData must have
// a non-null ISessionStateItemCollection.
public abstract SessionStateStoreData CreateNewStoreData(HttpContext context, int timeout);
public abstract void CreateUninitializedItem(HttpContext context, String id, int timeout);
// Called during EndRequest event
public abstract void EndRequest(HttpContext context);
internal virtual void Initialize(string name, NameValueCollection config, IPartitionResolver partitionResolver) {
}
}
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public class SessionStateStoreData {
ISessionStateItemCollection _sessionItems;
HttpStaticObjectsCollection _staticObjects;
int _timeout;
public SessionStateStoreData(ISessionStateItemCollection sessionItems,
HttpStaticObjectsCollection staticObjects,
int timeout) {
_sessionItems = sessionItems;
_staticObjects = staticObjects;
_timeout = timeout;
}
virtual public ISessionStateItemCollection Items {
get {
return _sessionItems;
}
}
virtual public HttpStaticObjectsCollection StaticObjects {
get {
return _staticObjects;
}
}
virtual public int Timeout {
get {
return _timeout;
}
set {
_timeout = value;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
* SessionStateStoreProviderBase
*
*/
namespace System.Web.SessionState {
using System.Xml;
using System.Security.Permissions;
using System.Configuration.Provider;
using System.Collections.Specialized;
[FlagsAttribute()]
internal enum SessionStateItemFlags : int {
None = 0x00000000,
Uninitialized = 0x00000001,
IgnoreCacheItemRemoved = 0x00000002
}
[FlagsAttribute()]
public enum SessionStateActions : int {
None = 0x00000000,
InitializeItem = 0x00000001
}
// This interface is used by SessionStateModule to read/write the session state data
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public abstract class SessionStateStoreProviderBase : ProviderBase {
public abstract void Dispose();
// Called by SessionStateModule to notify the provider that Session_End is defined
// in global.asax, and so when an item expires, it should call the expireCallback
// If the provider does not support session expiry, it should return false.
public abstract bool SetItemExpireCallback(SessionStateItemExpireCallback expireCallback);
// Called at the beginning of the AcquireRequestState event
public abstract void InitializeRequest(HttpContext context);
// Get and return a SessionStateStoreData.
// Please note that we are implementing a reader/writer lock mechanism.
//
// If successful:
// - returns the item
//
// If not found:
// - set 'locked' to false
// - returns null
//
// If the item is already locked by another request:
// - set 'locked' to true
// - set 'lockAge' to how long has the item been locked
// - set 'lockId' to the context of the lock
// - returns null
public abstract SessionStateStoreData GetItem(HttpContext context,
String id,
out bool locked,
out TimeSpan lockAge,
out object lockId,
out SessionStateActions actions);
// Get and lock a SessionStateStoreData.
// Please note that we are implementing a reader/writer lock mechanism.
//
// If successful:
// - set 'lockId' to the context of the lock
// - returns the item
//
// If not found:
// - set 'locked' to false
// - returns null
//
// If the item is already locked by another request:
// - set 'locked' to true
// - set 'lockAge' to how long has the item been locked
// - set 'lockId' to the context of the lock
// - returns null
public abstract SessionStateStoreData GetItemExclusive(HttpContext context,
String id,
out bool locked,
out TimeSpan lockAge,
out object lockId,
out SessionStateActions actions);
// Unlock an item locked by GetExclusive
// 'lockId' is the lock context returned by previous call to GetExclusive
public abstract void ReleaseItemExclusive(HttpContext context,
String id,
object lockId);
// Write an item.
// Note: The item is originally obtained by GetExclusive
// Because SessionStateModule will release (by ReleaseExclusive) am item if
// it has been locked for too long, so it is possible that the request calling
// Set() may have lost the lock to someone else already. This can be
// discovered by comparing the supplied lockId with the lockId value
// stored with the state item.
public abstract void SetAndReleaseItemExclusive(HttpContext context,
String id,
SessionStateStoreData item,
object lockId,
bool newItem);
// Remove an item. See the note in Set.
public abstract void RemoveItem(HttpContext context,
String id,
object lockId,
SessionStateStoreData item);
// Reset the expire time of an item based on its timeout value
public abstract void ResetItemTimeout(HttpContext context, String id);
// Create a brand new SessionStateStoreData. The created SessionStateStoreData must have
// a non-null ISessionStateItemCollection.
public abstract SessionStateStoreData CreateNewStoreData(HttpContext context, int timeout);
public abstract void CreateUninitializedItem(HttpContext context, String id, int timeout);
// Called during EndRequest event
public abstract void EndRequest(HttpContext context);
internal virtual void Initialize(string name, NameValueCollection config, IPartitionResolver partitionResolver) {
}
}
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public class SessionStateStoreData {
ISessionStateItemCollection _sessionItems;
HttpStaticObjectsCollection _staticObjects;
int _timeout;
public SessionStateStoreData(ISessionStateItemCollection sessionItems,
HttpStaticObjectsCollection staticObjects,
int timeout) {
_sessionItems = sessionItems;
_staticObjects = staticObjects;
_timeout = timeout;
}
virtual public ISessionStateItemCollection Items {
get {
return _sessionItems;
}
}
virtual public HttpStaticObjectsCollection StaticObjects {
get {
return _staticObjects;
}
}
virtual public int Timeout {
get {
return _timeout;
}
set {
_timeout = value;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FormViewDeleteEventArgs.cs
- FlowPosition.cs
- Calendar.cs
- DateRangeEvent.cs
- BitmapSourceSafeMILHandle.cs
- CompatibleComparer.cs
- DefaultAsyncDataDispatcher.cs
- Int16Converter.cs
- CorrelationScope.cs
- Popup.cs
- RightsManagementEncryptionTransform.cs
- NamespaceMapping.cs
- CommandID.cs
- CreateInstanceBinder.cs
- ProviderException.cs
- ObjectCache.cs
- ComEventsSink.cs
- StorageRoot.cs
- FileDialogCustomPlace.cs
- UnionExpr.cs
- SqlAliaser.cs
- SystemDropShadowChrome.cs
- GeneralTransform3DCollection.cs
- DBDataPermissionAttribute.cs
- XmlCharCheckingReader.cs
- SyndicationItem.cs
- Activation.cs
- PipelineModuleStepContainer.cs
- _FtpDataStream.cs
- MultiAsyncResult.cs
- CounterSampleCalculator.cs
- SiteMap.cs
- MenuBase.cs
- TracingConnection.cs
- InputScopeConverter.cs
- SystemEvents.cs
- WebColorConverter.cs
- MdiWindowListItemConverter.cs
- SetStateDesigner.cs
- ResourceManagerWrapper.cs
- WorkflowDataContext.cs
- TextDecorationUnitValidation.cs
- SerializationObjectManager.cs
- RIPEMD160.cs
- CodeDirectiveCollection.cs
- RemotingAttributes.cs
- Configuration.cs
- DocumentSequence.cs
- Evidence.cs
- SolidColorBrush.cs
- NotificationContext.cs
- SocketPermission.cs
- EntitySqlException.cs
- EntityContainerEmitter.cs
- DesignerVerb.cs
- Int32Storage.cs
- ThicknessAnimationBase.cs
- PeerNameRecord.cs
- BinaryObjectWriter.cs
- Geometry.cs
- clipboard.cs
- GridViewPageEventArgs.cs
- FontSource.cs
- KeyInfo.cs
- FullTextLine.cs
- DataGridViewRowsAddedEventArgs.cs
- NativeCompoundFileAPIs.cs
- NotSupportedException.cs
- ToolStripDropDownItem.cs
- XamlParser.cs
- M3DUtil.cs
- DbMetaDataCollectionNames.cs
- _SslState.cs
- TreeViewEvent.cs
- XmlLangPropertyAttribute.cs
- GlyphsSerializer.cs
- basevalidator.cs
- SqlDataSourceSummaryPanel.cs
- Optimizer.cs
- fixedPageContentExtractor.cs
- TreeNodeClickEventArgs.cs
- Base64Stream.cs
- Matrix3D.cs
- EmptyStringExpandableObjectConverter.cs
- RegexWorker.cs
- SocketInformation.cs
- RuleSettingsCollection.cs
- SiteMapProvider.cs
- TcpClientChannel.cs
- FirstMatchCodeGroup.cs
- WebChannelFactory.cs
- XmlQualifiedNameTest.cs
- XmlSchemaDocumentation.cs
- Utils.cs
- BaseServiceProvider.cs
- XhtmlTextWriter.cs
- ListSortDescription.cs
- AuthenticationConfig.cs
- SqlErrorCollection.cs
- PointAnimationUsingKeyFrames.cs