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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ImageBrush.cs
- SimpleRecyclingCache.cs
- SoundPlayer.cs
- JavaScriptObjectDeserializer.cs
- DateTimeSerializationSection.cs
- ServiceParser.cs
- __Filters.cs
- SqlStream.cs
- PolicyManager.cs
- XmlBinaryReader.cs
- NetworkInformationException.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- TextRunCache.cs
- TreeViewAutomationPeer.cs
- FlowLayout.cs
- JapaneseLunisolarCalendar.cs
- ProfileEventArgs.cs
- DataGridTextBox.cs
- FileDataSourceCache.cs
- XmlSchemaObjectCollection.cs
- NameService.cs
- MatcherBuilder.cs
- Parameter.cs
- DetailsViewUpdatedEventArgs.cs
- EndPoint.cs
- HostAdapter.cs
- ConstraintManager.cs
- TdsValueSetter.cs
- AudioFormatConverter.cs
- LayoutUtils.cs
- DbProviderFactories.cs
- AttributeProviderAttribute.cs
- OletxTransactionManager.cs
- SoapCommonClasses.cs
- MatrixKeyFrameCollection.cs
- XmlPreloadedResolver.cs
- Queue.cs
- MouseGestureConverter.cs
- ExportOptions.cs
- CheckBoxRenderer.cs
- XPathSelectionIterator.cs
- UnmanagedBitmapWrapper.cs
- ControlParameter.cs
- TextSegment.cs
- ManagementNamedValueCollection.cs
- ErrorTableItemStyle.cs
- LabelEditEvent.cs
- XomlDesignerLoader.cs
- DataRowChangeEvent.cs
- ImageMapEventArgs.cs
- HwndMouseInputProvider.cs
- HttpWebRequest.cs
- ListItemParagraph.cs
- ProcessThread.cs
- EntityPropertyMappingAttribute.cs
- LayoutTable.cs
- MetafileHeader.cs
- FixedElement.cs
- EncodingFallbackAwareXmlTextWriter.cs
- TextEndOfSegment.cs
- HighlightComponent.cs
- InheritanceRules.cs
- ExpressionVisitorHelpers.cs
- PropertyChangedEventManager.cs
- Environment.cs
- PolyBezierSegment.cs
- CompilerResults.cs
- XPathException.cs
- SecurityAttributeGenerationHelper.cs
- PatternMatcher.cs
- AtomPub10CategoriesDocumentFormatter.cs
- ExtensibleClassFactory.cs
- CodeIterationStatement.cs
- FileClassifier.cs
- SmiContext.cs
- StackOverflowException.cs
- TabPageDesigner.cs
- DataObjectEventArgs.cs
- ToolStripDropDownMenu.cs
- InstanceDataCollection.cs
- ClientSession.cs
- ConditionChanges.cs
- ChangeNode.cs
- XamlReader.cs
- EncodingNLS.cs
- TemplateControlParser.cs
- FamilyTypefaceCollection.cs
- TreeView.cs
- StyleSheetComponentEditor.cs
- InvalidateEvent.cs
- ProviderIncompatibleException.cs
- PeerNeighborManager.cs
- DataGridViewSelectedColumnCollection.cs
- LogSwitch.cs
- CodeExporter.cs
- columnmapkeybuilder.cs
- StringValidator.cs
- ImageSource.cs
- DummyDataSource.cs
- SQLSingleStorage.cs