Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / xsp / System / Web / Configuration / MachineKeyConverter.cs / 1 / MachineKeyConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Collections.Specialized; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; using System.Configuration; namespace System.Web.Configuration { [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class MachineKeyValidationConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { if ((value != null) && (value.GetType() != typeof(MachineKeyValidation))) { throw new ArgumentException(SR.GetString(SR.Invalid_enum_value, "SHA1, MD5, 3DES, AES")); } switch ((MachineKeyValidation)value) { case MachineKeyValidation.SHA1: return (string) "SHA1"; case MachineKeyValidation.MD5: return (string)"MD5"; case MachineKeyValidation.TripleDES: return (string)"3DES"; case MachineKeyValidation.AES: return (string)"AES"; default: throw new ArgumentOutOfRangeException("value"); } } public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { // Debug.Assert( data is string ); string s = (string)data; switch (s) { case "SHA1": return MachineKeyValidation.SHA1; case "MD5": return MachineKeyValidation.MD5; case "3DES": return MachineKeyValidation.TripleDES; case "AES": return MachineKeyValidation.AES; default: throw new ArgumentException(SR.GetString(SR.Config_Invalid_enum_value, "SHA1, MD5, 3DES, AES")); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Collections.Specialized; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; using System.Configuration; namespace System.Web.Configuration { [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class MachineKeyValidationConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { if ((value != null) && (value.GetType() != typeof(MachineKeyValidation))) { throw new ArgumentException(SR.GetString(SR.Invalid_enum_value, "SHA1, MD5, 3DES, AES")); } switch ((MachineKeyValidation)value) { case MachineKeyValidation.SHA1: return (string) "SHA1"; case MachineKeyValidation.MD5: return (string)"MD5"; case MachineKeyValidation.TripleDES: return (string)"3DES"; case MachineKeyValidation.AES: return (string)"AES"; default: throw new ArgumentOutOfRangeException("value"); } } public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { // Debug.Assert( data is string ); string s = (string)data; switch (s) { case "SHA1": return MachineKeyValidation.SHA1; case "MD5": return MachineKeyValidation.MD5; case "3DES": return MachineKeyValidation.TripleDES; case "AES": return MachineKeyValidation.AES; default: throw new ArgumentException(SR.GetString(SR.Config_Invalid_enum_value, "SHA1, MD5, 3DES, AES")); } } } } // 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
- InvalidDataException.cs
- Span.cs
- XmlSchemaDocumentation.cs
- XmlObjectSerializerContext.cs
- HttpHandlersSection.cs
- FloaterBaseParaClient.cs
- DataObjectSettingDataEventArgs.cs
- __ComObject.cs
- TriggerCollection.cs
- EmptyQuery.cs
- TimeoutException.cs
- Win32.cs
- ConnectionPointConverter.cs
- SoapProtocolReflector.cs
- DynamicDiscoSearcher.cs
- TreeViewHitTestInfo.cs
- SendActivity.cs
- XamlTypeMapper.cs
- CategoryNameCollection.cs
- XhtmlBasicPanelAdapter.cs
- UnsafeNativeMethods.cs
- SerialStream.cs
- Atom10FormatterFactory.cs
- ImmComposition.cs
- CodeArrayCreateExpression.cs
- RunWorkerCompletedEventArgs.cs
- BitmapEffectDrawingContextState.cs
- UniqueSet.cs
- SqlFileStream.cs
- OleDbCommandBuilder.cs
- DelimitedListTraceListener.cs
- _SpnDictionary.cs
- Char.cs
- ProvideValueServiceProvider.cs
- ResourceAttributes.cs
- HtmlInputImage.cs
- ParagraphResult.cs
- PerformanceCounter.cs
- StructuredProperty.cs
- sqlstateclientmanager.cs
- RenderOptions.cs
- SerializerDescriptor.cs
- ValueTypeFixupInfo.cs
- Positioning.cs
- GridToolTip.cs
- SystemDropShadowChrome.cs
- RawStylusInputCustomData.cs
- COM2ExtendedTypeConverter.cs
- InputBindingCollection.cs
- CachedRequestParams.cs
- TaskExtensions.cs
- ListComponentEditor.cs
- XmlCharCheckingWriter.cs
- CollaborationHelperFunctions.cs
- CryptoApi.cs
- CommonDialog.cs
- XmlNavigatorFilter.cs
- ZoneLinkButton.cs
- ZoneIdentityPermission.cs
- SelectionBorderGlyph.cs
- ExeContext.cs
- EditorPartDesigner.cs
- CollectionContainer.cs
- GiveFeedbackEvent.cs
- ColorTransformHelper.cs
- ConstraintStruct.cs
- AncillaryOps.cs
- ObjectListComponentEditor.cs
- SafeNativeMethodsMilCoreApi.cs
- EventLogEntryCollection.cs
- UIElementPropertyUndoUnit.cs
- GridViewCellAutomationPeer.cs
- StateItem.cs
- SQLDateTimeStorage.cs
- HttpWebRequestElement.cs
- CssClassPropertyAttribute.cs
- BasicViewGenerator.cs
- SizeIndependentAnimationStorage.cs
- DataGridDetailsPresenterAutomationPeer.cs
- BasicHttpMessageSecurityElement.cs
- XmlSchemaComplexContentRestriction.cs
- HttpCapabilitiesBase.cs
- RegistryPermission.cs
- LogSwitch.cs
- RecognizeCompletedEventArgs.cs
- LocalFileSettingsProvider.cs
- PathSegment.cs
- InkCanvasSelectionAdorner.cs
- ChannelManager.cs
- SmiConnection.cs
- SqlDataSourceQuery.cs
- ServiceSettingsResponseInfo.cs
- ColorAnimation.cs
- DataGridViewHitTestInfo.cs
- Group.cs
- InvalidComObjectException.cs
- UriTemplatePathPartiallyEquivalentSet.cs
- NamespaceImport.cs
- XmlSerializerNamespaces.cs
- ConfigurationPropertyAttribute.cs