Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / Configuration / MachineKeyConverter.cs / 5 / 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
- odbcmetadatacolumnnames.cs
- RuleSettings.cs
- OracleLob.cs
- TextHidden.cs
- StaticDataManager.cs
- InvokeGenerator.cs
- QilInvokeLateBound.cs
- SelectionRangeConverter.cs
- Rect3D.cs
- KeyValueInternalCollection.cs
- InvalidWMPVersionException.cs
- TextRangeEdit.cs
- QueryContinueDragEventArgs.cs
- ReplacementText.cs
- WindowsIdentity.cs
- EventLogEntryCollection.cs
- HtmlTernaryTree.cs
- MultiDataTrigger.cs
- MetadataItem.cs
- DynamicRendererThreadManager.cs
- ScriptManagerProxy.cs
- CompatibleComparer.cs
- RegistryKey.cs
- WebUtil.cs
- Win32PrintDialog.cs
- ProjectionPathSegment.cs
- DeflateEmulationStream.cs
- DirectionalLight.cs
- ArgIterator.cs
- StylusButton.cs
- Membership.cs
- XmlSchemaSimpleContent.cs
- CommandValueSerializer.cs
- newinstructionaction.cs
- ToolStripMenuItemDesigner.cs
- TextReader.cs
- Geometry.cs
- PeerContact.cs
- SkipStoryboardToFill.cs
- DataGridItem.cs
- AssociationType.cs
- ApplicationServicesHostFactory.cs
- ControlHelper.cs
- SmtpMail.cs
- HierarchicalDataSourceControl.cs
- UpdateProgress.cs
- ContextInformation.cs
- IconConverter.cs
- InvokePattern.cs
- InternalTypeHelper.cs
- MenuRenderer.cs
- DetailsViewInsertedEventArgs.cs
- OrderToken.cs
- ExtensionWindowHeader.cs
- ImageKeyConverter.cs
- httpserverutility.cs
- Comparer.cs
- HttpProfileGroupBase.cs
- StateRuntime.cs
- EditingScopeUndoUnit.cs
- Comparer.cs
- MessageAction.cs
- ThicknessKeyFrameCollection.cs
- Emitter.cs
- ValueQuery.cs
- XPathNodeHelper.cs
- ByteStream.cs
- Application.cs
- HtmlLink.cs
- TableLayoutRowStyleCollection.cs
- FixedPageStructure.cs
- AlphabeticalEnumConverter.cs
- PropertyGroupDescription.cs
- RelatedCurrencyManager.cs
- HttpWebRequest.cs
- OneOfElement.cs
- CmsInterop.cs
- SuppressMessageAttribute.cs
- SecurityElement.cs
- CodeSnippetStatement.cs
- ExtendedPropertyDescriptor.cs
- XComponentModel.cs
- XmlSchemaSimpleContent.cs
- TemplateControlBuildProvider.cs
- WhitespaceRule.cs
- EmulateRecognizeCompletedEventArgs.cs
- TimeSpan.cs
- WebPartDisplayModeCancelEventArgs.cs
- mediaclock.cs
- EntityTransaction.cs
- ObjectStateEntryDbDataRecord.cs
- TlsSspiNegotiation.cs
- DoubleLinkList.cs
- ZipFileInfoCollection.cs
- XNodeValidator.cs
- DataGridRowClipboardEventArgs.cs
- smtppermission.cs
- AnimationClock.cs
- OutputCacheModule.cs
- EmptyStringExpandableObjectConverter.cs