Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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")); } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ValueSerializerAttribute.cs
- ToolStripScrollButton.cs
- OracleTimeSpan.cs
- FullTrustAssemblyCollection.cs
- DefaultParameterValueAttribute.cs
- ApplicationActivator.cs
- SymLanguageType.cs
- SystemIPv4InterfaceProperties.cs
- UpdateExpressionVisitor.cs
- DependencyPropertyValueSerializer.cs
- StylusTip.cs
- TypeElementCollection.cs
- AddToCollection.cs
- DataFormat.cs
- XamlPathDataSerializer.cs
- UnmanagedMemoryStreamWrapper.cs
- Byte.cs
- NamespaceInfo.cs
- SafeBuffer.cs
- ChangesetResponse.cs
- AppDomainProtocolHandler.cs
- DateTimeFormatInfo.cs
- SoapRpcMethodAttribute.cs
- RouteItem.cs
- BooleanExpr.cs
- AsyncParams.cs
- HtmlTableCellCollection.cs
- InputProcessorProfiles.cs
- OleAutBinder.cs
- CalendarDesigner.cs
- connectionpool.cs
- PresentationAppDomainManager.cs
- PublisherMembershipCondition.cs
- xsdvalidator.cs
- DesignTimeParseData.cs
- XmlBufferReader.cs
- Pair.cs
- TemplatedAdorner.cs
- NonSerializedAttribute.cs
- AspNetSynchronizationContext.cs
- InkCanvasSelection.cs
- StringInfo.cs
- DependencyPropertyChangedEventArgs.cs
- SqlCacheDependencySection.cs
- XmlEntity.cs
- ToolStripContainerActionList.cs
- FixedStringLookup.cs
- OperatorExpressions.cs
- UInt16.cs
- BrowserTree.cs
- FixedStringLookup.cs
- ConfigXmlWhitespace.cs
- CollectionsUtil.cs
- ParameterReplacerVisitor.cs
- SchemaNotation.cs
- StylusDevice.cs
- ConfigurationStrings.cs
- SQLDoubleStorage.cs
- BasicHttpMessageSecurity.cs
- MultiAsyncResult.cs
- BamlTreeNode.cs
- BorderGapMaskConverter.cs
- TraceContextRecord.cs
- AttributeTableBuilder.cs
- CssStyleCollection.cs
- ProcessHostServerConfig.cs
- ControlBindingsCollection.cs
- ContentValidator.cs
- UriPrefixTable.cs
- CodeTypeParameterCollection.cs
- UnknownBitmapEncoder.cs
- StorageBasedPackageProperties.cs
- BufferedGraphics.cs
- QueryCacheEntry.cs
- ControlValuePropertyAttribute.cs
- RIPEMD160Managed.cs
- SystemIcmpV4Statistics.cs
- ConfigurationElementProperty.cs
- CorrelationManager.cs
- LineServicesRun.cs
- IsolatedStorageSecurityState.cs
- FormViewInsertEventArgs.cs
- Identifier.cs
- IntSecurity.cs
- DefaultProxySection.cs
- Viewport3DAutomationPeer.cs
- HttpFileCollectionWrapper.cs
- Query.cs
- ContentTypeSettingClientMessageFormatter.cs
- SystemInformation.cs
- DesignerMetadata.cs
- DataControlFieldCollection.cs
- XamlSerializerUtil.cs
- MarshalDirectiveException.cs
- BindableAttribute.cs
- SqlDataSourceSelectingEventArgs.cs
- Convert.cs
- ToolStripDropDownClosingEventArgs.cs
- QueryHandler.cs
- SQLMembershipProvider.cs