Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MetabaseReader.cs
- TypeContext.cs
- CustomMenuItemCollection.cs
- XMLDiffLoader.cs
- SmiEventStream.cs
- CalloutQueueItem.cs
- ElementNotEnabledException.cs
- Visual.cs
- StatusBarPanel.cs
- COM2ColorConverter.cs
- EventPropertyMap.cs
- Pkcs7Signer.cs
- EditCommandColumn.cs
- Int64Animation.cs
- WebPartManager.cs
- GacUtil.cs
- UpdatePanelTriggerCollection.cs
- DoubleLinkList.cs
- TargetInvocationException.cs
- StylusPointPropertyInfo.cs
- DocComment.cs
- TextComposition.cs
- ScrollProviderWrapper.cs
- IndexedGlyphRun.cs
- SchemaImporter.cs
- CustomWebEventKey.cs
- XmlMtomReader.cs
- ApplicationException.cs
- CreateUserErrorEventArgs.cs
- GraphicsContext.cs
- FlowPosition.cs
- LogicalExpr.cs
- NotConverter.cs
- TemplatedWizardStep.cs
- UDPClient.cs
- FaultBookmark.cs
- NewArrayExpression.cs
- DispatcherHooks.cs
- RegexCharClass.cs
- Substitution.cs
- ConfigXmlReader.cs
- SafeCryptContextHandle.cs
- TableRowGroup.cs
- OwnerDrawPropertyBag.cs
- ButtonStandardAdapter.cs
- HostedController.cs
- ContainerControl.cs
- HttpModuleAction.cs
- ExpandCollapseProviderWrapper.cs
- TransactionManager.cs
- SqlBulkCopyColumnMappingCollection.cs
- DataGrid.cs
- BrowserCapabilitiesCompiler.cs
- DeferredSelectedIndexReference.cs
- XsdDataContractExporter.cs
- DbSetClause.cs
- UInt16.cs
- ConfigurationManagerHelper.cs
- EmptyQuery.cs
- SaveFileDialog.cs
- ToolStripDropDownClosingEventArgs.cs
- dbenumerator.cs
- UnsafeNativeMethods.cs
- BuildProvider.cs
- WsatServiceCertificate.cs
- CatalogZone.cs
- cryptoapiTransform.cs
- NamedPipeAppDomainProtocolHandler.cs
- GenericEnumerator.cs
- AddInController.cs
- BitmapFrameEncode.cs
- BindingExpressionBase.cs
- State.cs
- UntrustedRecipientException.cs
- EntityContainerEntitySet.cs
- ClientClassGenerator.cs
- GZipStream.cs
- Pair.cs
- LongPath.cs
- mediaeventargs.cs
- DynamicQueryStringParameter.cs
- SafeMemoryMappedViewHandle.cs
- ModuleElement.cs
- RotationValidation.cs
- UserControlBuildProvider.cs
- TreeIterators.cs
- DataColumnChangeEvent.cs
- MimeReflector.cs
- ProfilePropertySettingsCollection.cs
- MoveSizeWinEventHandler.cs
- VectorCollectionValueSerializer.cs
- FontSourceCollection.cs
- printdlgexmarshaler.cs
- PropertyHelper.cs
- XamlRtfConverter.cs
- WindowsIdentity.cs
- SecurityElement.cs
- XmlNode.cs
- Assert.cs
- CallContext.cs