Code:
/ DotNET / DotNET / 8.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
- CLSCompliantAttribute.cs
- ItemCollection.cs
- RC2CryptoServiceProvider.cs
- ProfilePropertySettings.cs
- ElementNotAvailableException.cs
- FacetChecker.cs
- Site.cs
- TransformationRules.cs
- Win32SafeHandles.cs
- XmlAttributes.cs
- CFStream.cs
- DocumentXPathNavigator.cs
- CustomBindingCollectionElement.cs
- GregorianCalendarHelper.cs
- ButtonChrome.cs
- GregorianCalendarHelper.cs
- CssClassPropertyAttribute.cs
- _FtpControlStream.cs
- PolicyDesigner.cs
- propertytag.cs
- DispatchChannelSink.cs
- EncodingNLS.cs
- NativeRightsManagementAPIsStructures.cs
- TextFormatter.cs
- CompleteWizardStep.cs
- SchemaConstraints.cs
- CurrentTimeZone.cs
- BulletedList.cs
- ExtentKey.cs
- DynamicResourceExtensionConverter.cs
- DataGridTextBox.cs
- Identity.cs
- DataTrigger.cs
- X509Extension.cs
- CharStorage.cs
- basenumberconverter.cs
- DbProviderFactoriesConfigurationHandler.cs
- HandlerBase.cs
- HttpApplication.cs
- PersonalizationProviderHelper.cs
- UrlMapping.cs
- LocationInfo.cs
- RootProjectionNode.cs
- DataGridViewCellStyleBuilderDialog.cs
- OpenFileDialog.cs
- XmlQueryCardinality.cs
- RuntimeVariablesExpression.cs
- DataFormats.cs
- ElementProxy.cs
- ListBindableAttribute.cs
- CultureTableRecord.cs
- Rotation3DAnimation.cs
- SmiMetaDataProperty.cs
- NetTcpBindingElement.cs
- NullableFloatSumAggregationOperator.cs
- AsyncPostBackTrigger.cs
- KeyFrames.cs
- EdmScalarPropertyAttribute.cs
- FixedPageAutomationPeer.cs
- FormatterServicesNoSerializableCheck.cs
- XAMLParseException.cs
- SafeThreadHandle.cs
- ToolStripActionList.cs
- UIElement.cs
- CloudCollection.cs
- DataTableMapping.cs
- FillRuleValidation.cs
- Interop.cs
- PeekCompletedEventArgs.cs
- PowerModeChangedEventArgs.cs
- TemplatedMailWebEventProvider.cs
- SingleTagSectionHandler.cs
- ADMembershipProvider.cs
- ExceptionHandlersDesigner.cs
- MessageEncoder.cs
- ThreadInterruptedException.cs
- QueryContext.cs
- TextContainerChangeEventArgs.cs
- XmlHierarchyData.cs
- BatchStream.cs
- path.cs
- GraphicsPathIterator.cs
- CollectionChangedEventManager.cs
- PeerEndPoint.cs
- Expressions.cs
- NamespaceCollection.cs
- BuildProvider.cs
- AnimationException.cs
- MemberDescriptor.cs
- DataGridViewBindingCompleteEventArgs.cs
- TypedTableGenerator.cs
- ToolStripDropDownMenu.cs
- RepeatButton.cs
- NodeCounter.cs
- ParserOptions.cs
- TextBlock.cs
- AnchorEditor.cs
- grammarelement.cs
- CheckPair.cs
- SqlError.cs