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
- ExpressionLexer.cs
- EventLogTraceListener.cs
- OneOfElement.cs
- ParseHttpDate.cs
- DataChangedEventManager.cs
- Page.cs
- BaseValidator.cs
- SystemInfo.cs
- DispatcherSynchronizationContext.cs
- QuaternionAnimationBase.cs
- AttachedPropertyBrowsableAttribute.cs
- XmlSchemaAnyAttribute.cs
- HighlightVisual.cs
- RemotingSurrogateSelector.cs
- SpecularMaterial.cs
- ComponentEvent.cs
- _PooledStream.cs
- DataColumnCollection.cs
- PresentationSource.cs
- ViewStateModeByIdAttribute.cs
- Camera.cs
- Pkcs9Attribute.cs
- WebRequestModuleElementCollection.cs
- _RequestLifetimeSetter.cs
- SerializationAttributes.cs
- QueryResponse.cs
- QualifiedCellIdBoolean.cs
- ToolStripTextBox.cs
- LocalizabilityAttribute.cs
- PropertyEntry.cs
- ListViewInsertedEventArgs.cs
- WebControlsSection.cs
- TabItem.cs
- XmlnsDictionary.cs
- ControlValuePropertyAttribute.cs
- UICuesEvent.cs
- Point3DCollectionConverter.cs
- DecodeHelper.cs
- AttributeData.cs
- DataServiceRequestOfT.cs
- XmlDataSource.cs
- WsrmFault.cs
- TrustLevel.cs
- RegexMatchCollection.cs
- InvalidComObjectException.cs
- PersonalizationAdministration.cs
- ResourceReferenceExpression.cs
- SqlXml.cs
- FilterQuery.cs
- MergablePropertyAttribute.cs
- ILGenerator.cs
- JoinCqlBlock.cs
- MultiDataTrigger.cs
- ListenerElementsCollection.cs
- HtmlInputReset.cs
- XmlWriterSettings.cs
- ApplicationFileCodeDomTreeGenerator.cs
- InputBinder.cs
- ActivityCodeDomSerializer.cs
- IApplicationTrustManager.cs
- ApplicationFileCodeDomTreeGenerator.cs
- DateTimeConstantAttribute.cs
- ImageListStreamer.cs
- ToolStripLocationCancelEventArgs.cs
- BatchWriter.cs
- DataGridViewRowCancelEventArgs.cs
- BinaryMessageFormatter.cs
- DataServiceHost.cs
- querybuilder.cs
- QueryCacheEntry.cs
- PathFigure.cs
- ContainerParaClient.cs
- ADRoleFactoryConfiguration.cs
- RawKeyboardInputReport.cs
- ProgressChangedEventArgs.cs
- PublishLicense.cs
- MetadataArtifactLoaderResource.cs
- TextViewBase.cs
- RectKeyFrameCollection.cs
- StopStoryboard.cs
- DescendantQuery.cs
- XmlChoiceIdentifierAttribute.cs
- DataList.cs
- XPathNodeHelper.cs
- StateDesigner.CommentLayoutGlyph.cs
- EntityDesignerBuildProvider.cs
- DecoderReplacementFallback.cs
- ObjectDataSourceChooseMethodsPanel.cs
- SerialErrors.cs
- XmlValueConverter.cs
- ValueProviderWrapper.cs
- AcceleratedTokenProviderState.cs
- TemplateKeyConverter.cs
- GridSplitterAutomationPeer.cs
- CacheSection.cs
- ComEventsMethod.cs
- HostedHttpContext.cs
- EntityDataSourceContextCreatedEventArgs.cs
- Transform3DGroup.cs
- NamespaceTable.cs