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
- CodeRegionDirective.cs
- SoapReflectionImporter.cs
- UrlMappingsSection.cs
- TypeSemantics.cs
- ServerIdentity.cs
- UpdatePanel.cs
- WindowsTitleBar.cs
- DoubleLinkListEnumerator.cs
- LeafCellTreeNode.cs
- MetadataArtifactLoaderComposite.cs
- CustomError.cs
- remotingproxy.cs
- TypeExtension.cs
- FormatConvertedBitmap.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- SrgsItemList.cs
- SimpleWebHandlerParser.cs
- SplitterPanel.cs
- metadatamappinghashervisitor.cs
- MetadataArtifactLoaderResource.cs
- ComponentDispatcherThread.cs
- AssociatedControlConverter.cs
- PageCanvasSize.cs
- ImageDrawing.cs
- Module.cs
- ForEachAction.cs
- OdbcInfoMessageEvent.cs
- BCLDebug.cs
- RealProxy.cs
- Serializer.cs
- HeaderedItemsControl.cs
- BitmapEffectInputData.cs
- BitmapEffectDrawing.cs
- PersistenceException.cs
- MetadataCollection.cs
- InfoCardKeyedHashAlgorithm.cs
- TraceFilter.cs
- ServiceModelConfigurationSection.cs
- ProcessProtocolHandler.cs
- ImmutableAssemblyCacheEntry.cs
- UpDownEvent.cs
- OracleException.cs
- AsyncOperation.cs
- BindingCollection.cs
- DataTablePropertyDescriptor.cs
- CustomAttributeFormatException.cs
- CircleHotSpot.cs
- RecommendedAsConfigurableAttribute.cs
- XPathNodeHelper.cs
- MSAANativeProvider.cs
- SmiConnection.cs
- XPathSelfQuery.cs
- StorageEntityTypeMapping.cs
- Quaternion.cs
- EventProperty.cs
- entityreference_tresulttype.cs
- TextParagraphProperties.cs
- MetadataUtilsSmi.cs
- SqlMethodTransformer.cs
- VirtualPathProvider.cs
- IODescriptionAttribute.cs
- GridViewColumnHeaderAutomationPeer.cs
- serverconfig.cs
- Merger.cs
- SqlInternalConnectionSmi.cs
- ImageIndexConverter.cs
- DragDeltaEventArgs.cs
- TemplateBaseAction.cs
- SecurityListenerSettingsLifetimeManager.cs
- SoapHeader.cs
- MarkupWriter.cs
- FormDocumentDesigner.cs
- XmlArrayAttribute.cs
- BulletedListDesigner.cs
- KeyProperty.cs
- Int32.cs
- InvalidDocumentContentsException.cs
- WebConfigurationHostFileChange.cs
- CodeVariableReferenceExpression.cs
- OpenFileDialog.cs
- VoiceObjectToken.cs
- SparseMemoryStream.cs
- ThreadExceptionEvent.cs
- Document.cs
- UserPrincipalNameElement.cs
- ErrorWebPart.cs
- Context.cs
- GeneralTransform3DTo2D.cs
- ListViewItem.cs
- PhonemeConverter.cs
- ApplicationInfo.cs
- BuildManagerHost.cs
- InvalidCastException.cs
- HttpListenerContext.cs
- DocumentOrderQuery.cs
- DbConnectionPool.cs
- NamespaceCollection.cs
- TemplateApplicationHelper.cs
- DefaultValidator.cs
- ToolStripDropDown.cs