mscorlib(4.0.0.0) API with additions
ServicePointManagerElement.cs
2 using System.Net.Security;
3 
5 {
7  public sealed class ServicePointManagerElement : ConfigurationElement
8  {
9  private ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
10 
11  private readonly ConfigurationProperty checkCertificateName = new ConfigurationProperty("checkCertificateName", typeof(bool), true, ConfigurationPropertyOptions.None);
12 
13  private readonly ConfigurationProperty checkCertificateRevocationList = new ConfigurationProperty("checkCertificateRevocationList", typeof(bool), false, ConfigurationPropertyOptions.None);
14 
15  private readonly ConfigurationProperty dnsRefreshTimeout = new ConfigurationProperty("dnsRefreshTimeout", typeof(int), 120000, null, new TimeoutValidator(zeroValid: true), ConfigurationPropertyOptions.None);
16 
17  private readonly ConfigurationProperty enableDnsRoundRobin = new ConfigurationProperty("enableDnsRoundRobin", typeof(bool), false, ConfigurationPropertyOptions.None);
18 
19  private readonly ConfigurationProperty encryptionPolicy = new ConfigurationProperty("encryptionPolicy", typeof(EncryptionPolicy), EncryptionPolicy.RequireEncryption, ConfigurationPropertyOptions.None);
20 
21  private readonly ConfigurationProperty expect100Continue = new ConfigurationProperty("expect100Continue", typeof(bool), true, ConfigurationPropertyOptions.None);
22 
23  private readonly ConfigurationProperty useNagleAlgorithm = new ConfigurationProperty("useNagleAlgorithm", typeof(bool), true, ConfigurationPropertyOptions.None);
24 
28  [ConfigurationProperty("checkCertificateName", DefaultValue = true)]
29  public bool CheckCertificateName
30  {
31  get
32  {
33  return (bool)base[checkCertificateName];
34  }
35  set
36  {
37  base[checkCertificateName] = value;
38  }
39  }
40 
44  [ConfigurationProperty("checkCertificateRevocationList", DefaultValue = false)]
46  {
47  get
48  {
49  return (bool)base[checkCertificateRevocationList];
50  }
51  set
52  {
53  base[checkCertificateRevocationList] = value;
54  }
55  }
56 
59  [ConfigurationProperty("dnsRefreshTimeout", DefaultValue = 120000)]
60  public int DnsRefreshTimeout
61  {
62  get
63  {
64  return (int)base[dnsRefreshTimeout];
65  }
66  set
67  {
68  base[dnsRefreshTimeout] = value;
69  }
70  }
71 
75  [ConfigurationProperty("enableDnsRoundRobin", DefaultValue = false)]
76  public bool EnableDnsRoundRobin
77  {
78  get
79  {
80  return (bool)base[enableDnsRoundRobin];
81  }
82  set
83  {
84  base[enableDnsRoundRobin] = value;
85  }
86  }
87 
90  [ConfigurationProperty("encryptionPolicy", DefaultValue = EncryptionPolicy.RequireEncryption)]
92  {
93  get
94  {
95  return (EncryptionPolicy)base[encryptionPolicy];
96  }
97  set
98  {
99  base[encryptionPolicy] = value;
100  }
101  }
102 
106  [ConfigurationProperty("expect100Continue", DefaultValue = true)]
107  public bool Expect100Continue
108  {
109  get
110  {
111  return (bool)base[expect100Continue];
112  }
113  set
114  {
115  base[expect100Continue] = value;
116  }
117  }
118 
122  [ConfigurationProperty("useNagleAlgorithm", DefaultValue = true)]
123  public bool UseNagleAlgorithm
124  {
125  get
126  {
127  return (bool)base[useNagleAlgorithm];
128  }
129  set
130  {
131  base[useNagleAlgorithm] = value;
132  }
133  }
134 
135  protected internal override ConfigurationPropertyCollection Properties
136  {
137  protected get
138  {
139  return properties;
140  }
141  }
142 
145  {
146  properties.Add(checkCertificateName);
147  properties.Add(checkCertificateRevocationList);
148  properties.Add(dnsRefreshTimeout);
149  properties.Add(enableDnsRoundRobin);
150  properties.Add(encryptionPolicy);
151  properties.Add(expect100Continue);
152  properties.Add(useNagleAlgorithm);
153  }
154 
155  protected override void PostDeserialize()
156  {
157  if (base.EvaluationContext.IsMachineLevel)
158  {
159  return;
160  }
161  PropertyInformation[] array = new PropertyInformation[2]
162  {
163  base.ElementInformation.Properties["checkCertificateName"],
164  base.ElementInformation.Properties["checkCertificateRevocationList"]
165  };
166  PropertyInformation[] array2 = array;
167  foreach (PropertyInformation propertyInformation in array2)
168  {
169  if (propertyInformation.ValueOrigin == PropertyValueOrigin.SetHere)
170  {
171  try
172  {
173  ExceptionHelper.UnmanagedPermission.Demand();
174  }
175  catch (Exception inner)
176  {
177  throw new ConfigurationErrorsException(SR.GetString("net_config_property_permission", propertyInformation.Name), inner);
178  }
179  }
180  }
181  }
182  }
183 }
bool Expect100Continue
Gets or sets a Boolean value that determines whether 100-Continue behavior is used.
ServicePointManagerElement()
Initializes a new instance of the T:System.Net.Configuration.ServicePointManagerElement class.
EncryptionPolicy
The EncryptionPolicy to use.
Definition: __Canon.cs:3
Represents the default settings used to create connections to a remote computer. This class cannot be...
int DnsRefreshTimeout
Gets or sets the amount of time after which address information is refreshed.
bool CheckCertificateName
Gets or sets a Boolean value that controls checking host name information in an X509 certificate.
bool EnableDnsRoundRobin
Gets or sets a Boolean value that controls using different IP addresses on connections to the same se...
bool CheckCertificateRevocationList
Gets or sets a Boolean value that indicates whether the certificate is checked against the certificat...
bool UseNagleAlgorithm
Gets or sets a Boolean value that determines whether the Nagle algorithm is used.