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
- QuaternionIndependentAnimationStorage.cs
- WebPartDisplayModeEventArgs.cs
- DataGridViewCheckBoxColumn.cs
- UnsafeMethods.cs
- ProviderUtil.cs
- DataBindingCollection.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- DataObjectFieldAttribute.cs
- SqlClientPermission.cs
- NaturalLanguageHyphenator.cs
- PasswordBox.cs
- DataServiceException.cs
- COAUTHINFO.cs
- BamlResourceContent.cs
- TreeNodeStyle.cs
- PrintingPermissionAttribute.cs
- StreamAsIStream.cs
- SqlDataSourceStatusEventArgs.cs
- XmlSchemaComplexContentExtension.cs
- QueryOutputWriter.cs
- ToolStripButton.cs
- WebPartZone.cs
- Function.cs
- ObjectResult.cs
- FormsAuthenticationCredentials.cs
- BooleanAnimationUsingKeyFrames.cs
- HwndTarget.cs
- BrowserCapabilitiesCodeGenerator.cs
- MenuItem.cs
- DefaultValueTypeConverter.cs
- SpeakProgressEventArgs.cs
- BitmapEffectCollection.cs
- AmbiguousMatchException.cs
- DynamicResourceExtensionConverter.cs
- EdgeProfileValidation.cs
- ChangePasswordAutoFormat.cs
- Point3DConverter.cs
- CellParaClient.cs
- AssertFilter.cs
- InProcStateClientManager.cs
- NamespaceEmitter.cs
- MediaSystem.cs
- DebugViewWriter.cs
- DSASignatureFormatter.cs
- SessionSymmetricTransportSecurityProtocolFactory.cs
- CorrelationExtension.cs
- IdentitySection.cs
- TextServicesHost.cs
- ProcessThreadCollection.cs
- SingleAnimationBase.cs
- DataViewListener.cs
- CaseCqlBlock.cs
- JapaneseLunisolarCalendar.cs
- DelegatedStream.cs
- FunctionUpdateCommand.cs
- Quaternion.cs
- UIElement.cs
- CompModSwitches.cs
- NullRuntimeConfig.cs
- RightNameExpirationInfoPair.cs
- RequestCachePolicy.cs
- WindowsTab.cs
- Int16KeyFrameCollection.cs
- ClaimComparer.cs
- ProcessHostFactoryHelper.cs
- ServerReliableChannelBinder.cs
- XmlParserContext.cs
- BamlRecordReader.cs
- SpeechSynthesizer.cs
- Location.cs
- InstancePersistenceCommand.cs
- PassportAuthenticationModule.cs
- DBSqlParserTable.cs
- DbConnectionPoolOptions.cs
- RoleGroupCollection.cs
- FormattedTextSymbols.cs
- PerformanceCounterPermissionAttribute.cs
- OracleDataAdapter.cs
- XmlIlVisitor.cs
- DbResourceAllocator.cs
- MessageContractMemberAttribute.cs
- SqlAliasesReferenced.cs
- Stroke2.cs
- OneOf.cs
- XpsDocumentEvent.cs
- Command.cs
- TreeViewBindingsEditorForm.cs
- TraceUtils.cs
- ProcessHostServerConfig.cs
- CallbackValidator.cs
- SocketManager.cs
- AssertHelper.cs
- SqlProviderUtilities.cs
- AttachmentCollection.cs
- Point3DAnimationBase.cs
- UnsafeNativeMethodsPenimc.cs
- StorageConditionPropertyMapping.cs
- ConfigurationSectionCollection.cs
- HttpHandlersSection.cs
- InvalidChannelBindingException.cs