Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / Configuration / MachineKeyConverter.cs / 2 / 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. //------------------------------------------------------------------------------ //// 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- columnmapkeybuilder.cs
- AssemblyAssociatedContentFileAttribute.cs
- cryptoapiTransform.cs
- WebPart.cs
- Utils.cs
- PriorityItem.cs
- RegexStringValidator.cs
- StringArrayConverter.cs
- SmiTypedGetterSetter.cs
- UserNamePasswordValidationMode.cs
- CounterSample.cs
- SymbolEqualComparer.cs
- ArrayConverter.cs
- DataGridColumnStyleMappingNameEditor.cs
- HashCodeCombiner.cs
- XmlArrayAttribute.cs
- ListItemCollection.cs
- CqlParserHelpers.cs
- ListBoxItem.cs
- ApplicationCommands.cs
- Event.cs
- DocumentAutomationPeer.cs
- SqlPersonalizationProvider.cs
- BindingElementCollection.cs
- DockPanel.cs
- StyleSheet.cs
- HttpDictionary.cs
- DataRowChangeEvent.cs
- BinaryOperationBinder.cs
- StateMachineExecutionState.cs
- HttpStreamMessage.cs
- InkCanvasAutomationPeer.cs
- DataTemplateKey.cs
- CheckBoxBaseAdapter.cs
- GetCardDetailsRequest.cs
- Package.cs
- PingReply.cs
- SHA384Managed.cs
- ZipIOLocalFileDataDescriptor.cs
- State.cs
- DataViewSettingCollection.cs
- ToolStripDesignerAvailabilityAttribute.cs
- TimeManager.cs
- ApplyTemplatesAction.cs
- cookieexception.cs
- QueryCursorEventArgs.cs
- CompressedStack.cs
- TextTreeFixupNode.cs
- ContainerControl.cs
- AnnotationHelper.cs
- XDRSchema.cs
- InkCanvasSelection.cs
- TlsnegoTokenProvider.cs
- FormatConvertedBitmap.cs
- GregorianCalendar.cs
- DefaultMemberAttribute.cs
- XmlNodeChangedEventManager.cs
- WebPartChrome.cs
- FontStyleConverter.cs
- IdentityValidationException.cs
- SplashScreenNativeMethods.cs
- ProxyWebPartManager.cs
- ToggleButtonAutomationPeer.cs
- DropShadowBitmapEffect.cs
- SecurityContextSecurityTokenAuthenticator.cs
- TimelineClockCollection.cs
- MimeBasePart.cs
- PrintPreviewDialog.cs
- UpdateCommandGenerator.cs
- SqlNodeTypeOperators.cs
- Page.cs
- ServiceTimeoutsElement.cs
- CachingHintValidation.cs
- WebColorConverter.cs
- RuntimeHelpers.cs
- ContentElement.cs
- FormsIdentity.cs
- RemoteEndpointMessageProperty.cs
- DictionaryManager.cs
- DelegatingTypeDescriptionProvider.cs
- ColumnClickEvent.cs
- XslVisitor.cs
- RegistryKey.cs
- DataViewSettingCollection.cs
- TreeIterator.cs
- AbstractDataSvcMapFileLoader.cs
- RowToParametersTransformer.cs
- validation.cs
- XmlSchemaValidationException.cs
- GroupQuery.cs
- MultipleViewProviderWrapper.cs
- Point3D.cs
- SafeSystemMetrics.cs
- SerializationEventsCache.cs
- CodeTryCatchFinallyStatement.cs
- SqlDataReaderSmi.cs
- SoapBinding.cs
- ControlCachePolicy.cs
- DbProviderConfigurationHandler.cs
- DynamicMetaObjectBinder.cs