Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / Configuration / CustomErrorCollection.cs / 2 / CustomErrorCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; using System.Globalization; using System.Web.Util; using System.Web.Configuration; using System.Security.Permissions; [ConfigurationCollection(typeof(CustomError), AddItemName = "error", CollectionType = ConfigurationElementCollectionType.BasicMap)] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class CustomErrorCollection : ConfigurationElementCollection { private static ConfigurationPropertyCollection _properties; static CustomErrorCollection() { _properties = new ConfigurationPropertyCollection(); } public CustomErrorCollection() { } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } // public properties public String[] AllKeys { get { object[] objAllKeys = BaseGetAllKeys(); String[] stringKeys = new String[objAllKeys.Length]; for(int x = 0; x < objAllKeys.Length; x++) { stringKeys[x] = ((Int32)objAllKeys[x]).ToString(CultureInfo.InvariantCulture); } return stringKeys; } } public new CustomError this[string statusCode] { get { return (CustomError)BaseGet((object)Int32.Parse(statusCode, CultureInfo.InvariantCulture)); } } public CustomError this[int index] { get { return (CustomError)BaseGet(index); } set { if (BaseGet(index) != null) { BaseRemoveAt(index); } BaseAdd(index, value); } } // Protected Overrides protected override ConfigurationElement CreateNewElement() { return new CustomError(); } protected override Object GetElementKey(ConfigurationElement element) { return ((CustomError)element).StatusCode; } protected override string ElementName { get { return "error"; } } public override ConfigurationElementCollectionType CollectionType { get { return ConfigurationElementCollectionType.BasicMap; } } // public methods public void Add(CustomError customError) { BaseAdd(customError); } public void Clear() { BaseClear(); } public CustomError Get(int index) { return (CustomError)BaseGet(index); } public CustomError Get(string statusCode) { return (CustomError)BaseGet((object)Int32.Parse(statusCode, CultureInfo.InvariantCulture)); } public String GetKey(int index) { Int32 key = (Int32) BaseGetKey(index); return key.ToString(CultureInfo.InvariantCulture); } public void Remove(string statusCode) { BaseRemove((object)Int32.Parse(statusCode, CultureInfo.InvariantCulture)); } public void RemoveAt(int index) { BaseRemoveAt(index); } public void Set(CustomError customError) { BaseAdd(customError, false); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Profiler.cs
- XPathDocumentBuilder.cs
- DynamicArgumentDesigner.xaml.cs
- RichTextBoxDesigner.cs
- SQLString.cs
- MulticastDelegate.cs
- ColumnHeaderConverter.cs
- GeometryHitTestParameters.cs
- ScrollItemPattern.cs
- PseudoWebRequest.cs
- CodeTypeMember.cs
- ProjectionPlan.cs
- OutputCacheProfileCollection.cs
- DirectoryGroupQuery.cs
- SizeChangedInfo.cs
- CommonRemoteMemoryBlock.cs
- PartialArray.cs
- HttpSocketManager.cs
- FileChangesMonitor.cs
- InputScope.cs
- ImageMapEventArgs.cs
- RayMeshGeometry3DHitTestResult.cs
- MetadataHelper.cs
- ICspAsymmetricAlgorithm.cs
- PasswordRecovery.cs
- FragmentQuery.cs
- GradientSpreadMethodValidation.cs
- Padding.cs
- Latin1Encoding.cs
- TakeOrSkipQueryOperator.cs
- RepeaterItem.cs
- CompileXomlTask.cs
- RequestContext.cs
- StorageComplexPropertyMapping.cs
- SessionStateSection.cs
- ToolStripSplitButton.cs
- HttpApplicationStateBase.cs
- control.ime.cs
- DispatchChannelSink.cs
- AuthenticationException.cs
- RegexParser.cs
- ProtocolsConfigurationHandler.cs
- ResolveNameEventArgs.cs
- CollaborationHelperFunctions.cs
- NamespaceCollection.cs
- OracleSqlParser.cs
- TimeManager.cs
- CharacterMetricsDictionary.cs
- TextRangeEdit.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- SQLGuidStorage.cs
- EditorZone.cs
- Figure.cs
- Terminate.cs
- NonVisualControlAttribute.cs
- DbReferenceCollection.cs
- HttpDebugHandler.cs
- MouseEvent.cs
- DataTableCollection.cs
- SQLInt64.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- MenuItemBinding.cs
- DataGridViewElement.cs
- GCHandleCookieTable.cs
- ProfessionalColorTable.cs
- AnimationStorage.cs
- AppSettingsReader.cs
- PlaceHolder.cs
- FocusWithinProperty.cs
- ErrorRuntimeConfig.cs
- CacheChildrenQuery.cs
- PackageProperties.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- XmlNodeComparer.cs
- PropertyPath.cs
- ManagementPath.cs
- NullableDecimalAverageAggregationOperator.cs
- ComponentEditorPage.cs
- EraserBehavior.cs
- EntitySetRetriever.cs
- OrderByQueryOptionExpression.cs
- Wizard.cs
- ChineseLunisolarCalendar.cs
- EdmItemError.cs
- MeasureItemEvent.cs
- DataGridTextBoxColumn.cs
- XmlCustomFormatter.cs
- SqlWriter.cs
- NamespaceQuery.cs
- BinaryMethodMessage.cs
- UInt16.cs
- HwndSourceParameters.cs
- ComponentManagerBroker.cs
- EarlyBoundInfo.cs
- CriticalFileToken.cs
- ConfigurationSettings.cs
- WebResourceUtil.cs
- SiteOfOriginPart.cs
- DataObjectFieldAttribute.cs
- VisualStyleElement.cs