Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / Configuration / WebRequestModulesSection.cs / 1305376 / WebRequestModulesSection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net.Configuration { using System.Configuration; using System.Collections; using System.Globalization; using System.Net; using System.Reflection; using System.Threading; public sealed class WebRequestModulesSection : ConfigurationSection { public WebRequestModulesSection() { this.properties.Add(this.webRequestModules); } protected override void PostDeserialize() { // Perf optimization. If the configuration is coming from machine.config // It is safe and we don't need to check for permissions. if (EvaluationContext.IsMachineLevel) return; try { ExceptionHelper.WebPermissionUnrestricted.Demand(); } catch (Exception exception) { throw new ConfigurationErrorsException( SR.GetString(SR.net_config_section_permission, ConfigurationStrings.WebRequestModulesSectionName), exception); } } protected override void InitializeDefault() { this.WebRequestModules.Add( new WebRequestModuleElement(ConfigurationStrings.Https, typeof(HttpRequestCreator))); this.WebRequestModules.Add( new WebRequestModuleElement(ConfigurationStrings.Http, typeof(HttpRequestCreator))); this.WebRequestModules.Add( new WebRequestModuleElement(ConfigurationStrings.File, typeof(FileWebRequestCreator))); this.WebRequestModules.Add( new WebRequestModuleElement(ConfigurationStrings.Ftp, typeof(FtpWebRequestCreator))); } protected override ConfigurationPropertyCollection Properties { get { return this.properties; } } [ConfigurationProperty("", IsDefaultCollection=true )] public WebRequestModuleElementCollection WebRequestModules { get { return (WebRequestModuleElementCollection)this[this.webRequestModules]; } } ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection(); readonly ConfigurationProperty webRequestModules = new ConfigurationProperty(null, typeof(WebRequestModuleElementCollection), null, ConfigurationPropertyOptions.IsDefaultCollection); } internal sealed class WebRequestModulesSectionInternal { internal WebRequestModulesSectionInternal(WebRequestModulesSection section) { if (section.WebRequestModules.Count > 0) { this.webRequestModules = new ArrayList(section.WebRequestModules.Count); foreach(WebRequestModuleElement webRequestModuleElement in section.WebRequestModules) { try { this.webRequestModules.Add(new WebRequestPrefixElement(webRequestModuleElement.Prefix, webRequestModuleElement.Type)); } catch (Exception exception) { if (NclUtilities.IsFatal(exception)) throw; throw new ConfigurationErrorsException(SR.GetString(SR.net_config_webrequestmodules), exception); } } } } internal static object ClassSyncObject { get { if (classSyncObject == null) { object o = new object(); Interlocked.CompareExchange(ref classSyncObject, o, null); } return classSyncObject; } } static internal WebRequestModulesSectionInternal GetSection() { lock (WebRequestModulesSectionInternal.ClassSyncObject) { WebRequestModulesSection section = PrivilegedConfigurationManager.GetSection(ConfigurationStrings.WebRequestModulesSectionPath) as WebRequestModulesSection; if (section == null) return null; return new WebRequestModulesSectionInternal(section); } } internal ArrayList WebRequestModules { get { ArrayList retval = this.webRequestModules; if (retval == null) { retval = new ArrayList(0); } return retval; } } static object classSyncObject = null; ArrayList webRequestModules = null; } } // 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
- AudioException.cs
- GeometryCombineModeValidation.cs
- FontWeights.cs
- ServicesUtilities.cs
- sortedlist.cs
- DataGridPageChangedEventArgs.cs
- TypeContext.cs
- ChangePassword.cs
- CompositeFontParser.cs
- DelayedRegex.cs
- DSACryptoServiceProvider.cs
- OptimizedTemplateContentHelper.cs
- WindowsFormsEditorServiceHelper.cs
- ArrayMergeHelper.cs
- XmlValidatingReaderImpl.cs
- OnOperation.cs
- WebReferencesBuildProvider.cs
- TransformerTypeCollection.cs
- MarginsConverter.cs
- AsmxEndpointPickerExtension.cs
- SqlRowUpdatedEvent.cs
- DataGridRowClipboardEventArgs.cs
- WeakRefEnumerator.cs
- AddInDeploymentState.cs
- AspNetSynchronizationContext.cs
- ActivityExecutor.cs
- ModelVisual3D.cs
- DataGridBoolColumn.cs
- PublisherIdentityPermission.cs
- DeferredSelectedIndexReference.cs
- HttpCacheVary.cs
- AlphabetConverter.cs
- EditorPart.cs
- HtmlLink.cs
- BaseParagraph.cs
- UpdateTranslator.cs
- DisplayInformation.cs
- ConnectionStringsExpressionBuilder.cs
- HitTestFilterBehavior.cs
- ParenthesizePropertyNameAttribute.cs
- IdentityModelDictionary.cs
- ModelVisual3D.cs
- ParallelQuery.cs
- StrongTypingException.cs
- StaticResourceExtension.cs
- TextSegment.cs
- DetailsViewUpdatedEventArgs.cs
- ExpressionBuilder.cs
- SqlDataReader.cs
- HttpStreamMessageEncoderFactory.cs
- WpfKnownMemberInvoker.cs
- PropertyGeneratedEventArgs.cs
- IODescriptionAttribute.cs
- BitConverter.cs
- TextTreeRootNode.cs
- XmlEventCache.cs
- XmlHierarchyData.cs
- SQLInt32.cs
- BlurEffect.cs
- Int32CAMarshaler.cs
- ExpanderAutomationPeer.cs
- ProfileManager.cs
- ToolStripItemClickedEventArgs.cs
- TaskExceptionHolder.cs
- MultiView.cs
- SafeReadContext.cs
- OletxEnlistment.cs
- AppendHelper.cs
- SplashScreen.cs
- ArraySubsetEnumerator.cs
- EllipseGeometry.cs
- ProgressPage.cs
- EntryIndex.cs
- OpacityConverter.cs
- StringUtil.cs
- GeneralTransform3DTo2D.cs
- ObjectListCommandsPage.cs
- AdjustableArrowCap.cs
- Label.cs
- TextTreeNode.cs
- TreeIterator.cs
- StyleBamlTreeBuilder.cs
- safelink.cs
- SHA1CryptoServiceProvider.cs
- WindowsGraphicsWrapper.cs
- CompleteWizardStep.cs
- XamlContextStack.cs
- DiscardableAttribute.cs
- CompleteWizardStep.cs
- ArraySegment.cs
- WebProxyScriptElement.cs
- WCFServiceClientProxyGenerator.cs
- OverflowException.cs
- StreamingContext.cs
- DataServiceQueryOfT.cs
- DelegateCompletionCallbackWrapper.cs
- ObjectNavigationPropertyMapping.cs
- ServerReliableChannelBinder.cs
- HotSpot.cs
- TabControlEvent.cs