Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / SessionParameter.cs / 1 / SessionParameter.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.WebControls {
using System;
using System.ComponentModel;
using System.Security.Permissions;
///
/// Represents a Parameter that gets its value from the application's session state.
///
[
DefaultProperty("SessionField"),
]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public class SessionParameter : Parameter {
///
/// Creates an instance of the SessionParameter class.
///
public SessionParameter() {
}
///
/// Creates an instance of the SessionParameter class with the specified parameter name, and session field.
///
public SessionParameter(string name, string sessionField) : base(name) {
SessionField = sessionField;
}
///
/// Creates an instance of the SessionParameter class with the specified parameter name, type, and session field.
///
public SessionParameter(string name, TypeCode type, string sessionField) : base(name, type) {
SessionField = sessionField;
}
///
/// Used to clone a parameter.
///
protected SessionParameter(SessionParameter original) : base(original) {
SessionField = original.SessionField;
}
///
/// The name of the session variable to get the value from.
///
[
DefaultValue(""),
WebCategory("Parameter"),
WebSysDescription(SR.SessionParameter_SessionField),
]
public string SessionField {
get {
object o = ViewState["SessionField"];
if (o == null)
return String.Empty;
return (string)o;
}
set {
if (SessionField != value) {
ViewState["SessionField"] = value;
OnParameterChanged();
}
}
}
///
/// Creates a new SessionParameter that is a copy of this SessionParameter.
///
protected override Parameter Clone() {
return new SessionParameter(this);
}
///
/// Returns the updated value of the parameter.
///
protected override object Evaluate(HttpContext context, Control control) {
if (context == null || context.Session == null) {
return null;
}
return context.Session[SessionField];
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataKeyCollection.cs
- StylusPointProperties.cs
- XamlBuildProvider.cs
- ImageAnimator.cs
- ISFClipboardData.cs
- SchemaElementLookUpTable.cs
- XmlSchemaComplexType.cs
- SecurityPolicySection.cs
- ObjectItemConventionAssemblyLoader.cs
- TextWriter.cs
- ActivityWithResultWrapper.cs
- ProtocolState.cs
- SecurityKeyType.cs
- CompareValidator.cs
- DbConnectionPoolCounters.cs
- DbTransaction.cs
- Header.cs
- AccessDataSourceView.cs
- Hex.cs
- Drawing.cs
- CodeThrowExceptionStatement.cs
- HtmlElementErrorEventArgs.cs
- GAC.cs
- CharacterHit.cs
- MenuAdapter.cs
- SqlDependencyUtils.cs
- FixUpCollection.cs
- BulletedListDesigner.cs
- _NTAuthentication.cs
- OptimalBreakSession.cs
- Tile.cs
- StorageInfo.cs
- ItemChangedEventArgs.cs
- CodeSnippetCompileUnit.cs
- SafeIUnknown.cs
- SafeLibraryHandle.cs
- HttpSessionStateWrapper.cs
- XmlElement.cs
- GridViewSelectEventArgs.cs
- LocatorGroup.cs
- RegexCharClass.cs
- StatusBarDrawItemEvent.cs
- AppSettingsReader.cs
- ObjectParameterCollection.cs
- MsdtcClusterUtils.cs
- SpeechDetectedEventArgs.cs
- ColorMatrix.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- SingleResultAttribute.cs
- ExpandCollapseProviderWrapper.cs
- DataControlButton.cs
- UInt64Converter.cs
- PropertyItem.cs
- TimeStampChecker.cs
- ProfilePropertySettingsCollection.cs
- SerializationFieldInfo.cs
- StyleBamlRecordReader.cs
- BuildManagerHost.cs
- DecimalStorage.cs
- SharedStatics.cs
- PageStatePersister.cs
- figurelengthconverter.cs
- CachedCompositeFamily.cs
- MaterialCollection.cs
- _ConnectOverlappedAsyncResult.cs
- ControlAdapter.cs
- ToolStripControlHost.cs
- InheritanceUI.cs
- WebEvents.cs
- HostingEnvironmentException.cs
- HtmlAnchor.cs
- SqlConnectionPoolGroupProviderInfo.cs
- SqlPersonalizationProvider.cs
- OpenTypeLayout.cs
- ExpressionEvaluator.cs
- PointConverter.cs
- HMACSHA256.cs
- PickBranchDesigner.xaml.cs
- AppDomainFactory.cs
- ModuleBuilderData.cs
- HtmlInputCheckBox.cs
- CustomAttribute.cs
- unsafenativemethodsother.cs
- XmlCodeExporter.cs
- CryptoStream.cs
- KeyNotFoundException.cs
- RoleService.cs
- webeventbuffer.cs
- XmlSchemaGroupRef.cs
- StringUtil.cs
- Int16Storage.cs
- _CacheStreams.cs
- EnumerableWrapperWeakToStrong.cs
- RTTypeWrapper.cs
- LostFocusEventManager.cs
- DataObjectFieldAttribute.cs
- RemoteWebConfigurationHostStream.cs
- xmlformatgeneratorstatics.cs
- WorkflowOwnerAsyncResult.cs
- AppliedDeviceFiltersDialog.cs