2
0

HttpRuntimeSection.cs 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. //
  2. // System.Web.Configuration.HttpRuntimeSection
  3. //
  4. // Authors:
  5. // Chris Toshok ([email protected])
  6. //
  7. // (C) 2005 Novell, Inc (http://www.novell.com)
  8. //
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. #if NET_2_0
  30. using System;
  31. using System.ComponentModel;
  32. using System.Configuration;
  33. namespace System.Web.Configuration
  34. {
  35. public sealed class HttpRuntimeSection : ConfigurationSection
  36. {
  37. static ConfigurationProperty apartmentThreadingProp;
  38. static ConfigurationProperty appRequestQueueLimitProp;
  39. static ConfigurationProperty delayNotificationTimeoutProp;
  40. static ConfigurationProperty enableProp;
  41. static ConfigurationProperty enableHeaderCheckingProp;
  42. static ConfigurationProperty enableKernelOutputCacheProp;
  43. static ConfigurationProperty enableVersionHeaderProp;
  44. static ConfigurationProperty executionTimeoutProp;
  45. static ConfigurationProperty maxRequestLengthProp;
  46. static ConfigurationProperty maxWaitChangeNotificationProp;
  47. static ConfigurationProperty minFreeThreadsProp;
  48. static ConfigurationProperty minLocalRequestFreeThreadsProp;
  49. static ConfigurationProperty requestLengthDiskThresholdProp;
  50. static ConfigurationProperty requireRootedSaveAsPathProp;
  51. static ConfigurationProperty sendCacheControlHeaderProp;
  52. static ConfigurationProperty shutdownTimeoutProp;
  53. static ConfigurationProperty useFullyQualifiedRedirectUrlProp;
  54. static ConfigurationProperty waitChangeNotificationProp;
  55. static ConfigurationPropertyCollection properties;
  56. static HttpRuntimeSection ()
  57. {
  58. apartmentThreadingProp = new ConfigurationProperty ("apartmentThreading", typeof (bool), false);
  59. appRequestQueueLimitProp = new ConfigurationProperty ("appRequestQueueLimit", typeof (int), 5000);
  60. delayNotificationTimeoutProp = new ConfigurationProperty ("delayNotificationTimeout", typeof (TimeSpan), TimeSpan.FromSeconds (5));
  61. enableProp = new ConfigurationProperty ("enable", typeof (bool), true);
  62. enableHeaderCheckingProp = new ConfigurationProperty ("enableHeaderChecking", typeof (bool), true);
  63. enableKernelOutputCacheProp = new ConfigurationProperty ("enableKernelOutputCache", typeof (bool), true);
  64. enableVersionHeaderProp = new ConfigurationProperty ("enableVersionHeader", typeof (bool), true);
  65. executionTimeoutProp = new ConfigurationProperty ("executionTimeout", typeof (TimeSpan), TimeSpan.FromSeconds (110));
  66. maxRequestLengthProp = new ConfigurationProperty ("maxRequestLength", typeof (int), 4096);
  67. maxWaitChangeNotificationProp = new ConfigurationProperty ("maxWaitChangeNotification", typeof (int), 0);
  68. minFreeThreadsProp = new ConfigurationProperty ("minFreeThreads", typeof (int), 8);
  69. minLocalRequestFreeThreadsProp = new ConfigurationProperty ("minLocalRequestFreeThreads", typeof (int), 4);
  70. requestLengthDiskThresholdProp = new ConfigurationProperty ("requestLengthDiskThreshold", typeof (int), 80);
  71. requireRootedSaveAsPathProp = new ConfigurationProperty ("requireRootedSaveAsPath", typeof (bool), true);
  72. sendCacheControlHeaderProp = new ConfigurationProperty ("sendCacheControlHeader", typeof (bool), true);
  73. shutdownTimeoutProp = new ConfigurationProperty ("shutdownTimeout", typeof (TimeSpan), TimeSpan.FromSeconds (90));
  74. useFullyQualifiedRedirectUrlProp = new ConfigurationProperty ("useFullyQualifiedRedirectUrl", typeof (bool), false);
  75. waitChangeNotificationProp = new ConfigurationProperty ("waitChangeNotification", typeof (int), 0);
  76. properties = new ConfigurationPropertyCollection();
  77. properties.Add (apartmentThreadingProp);
  78. properties.Add (appRequestQueueLimitProp);
  79. properties.Add (delayNotificationTimeoutProp);
  80. properties.Add (enableProp);
  81. properties.Add (enableHeaderCheckingProp);
  82. properties.Add (enableKernelOutputCacheProp);
  83. properties.Add (enableVersionHeaderProp);
  84. properties.Add (executionTimeoutProp);
  85. properties.Add (maxRequestLengthProp);
  86. properties.Add (maxWaitChangeNotificationProp);
  87. properties.Add (minFreeThreadsProp);
  88. properties.Add (minLocalRequestFreeThreadsProp);
  89. properties.Add (requestLengthDiskThresholdProp);
  90. properties.Add (requireRootedSaveAsPathProp);
  91. properties.Add (sendCacheControlHeaderProp);
  92. properties.Add (shutdownTimeoutProp);
  93. properties.Add (useFullyQualifiedRedirectUrlProp);
  94. properties.Add (waitChangeNotificationProp);
  95. }
  96. public HttpRuntimeSection()
  97. {
  98. }
  99. [ConfigurationProperty ("apartmentThreading", DefaultValue = "False")]
  100. public bool ApartmentThreading {
  101. get { return (bool) base[apartmentThreadingProp]; }
  102. set { base[apartmentThreadingProp] = value; }
  103. }
  104. [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue)]
  105. [ConfigurationProperty ("appRequestQueueLimit", DefaultValue = "5000")]
  106. public int AppRequestQueueLimit {
  107. get { return (int) base[appRequestQueueLimitProp]; }
  108. set { base[appRequestQueueLimitProp] = value; }
  109. }
  110. [TypeConverter (typeof (TimeSpanSecondsConverter))]
  111. [ConfigurationProperty ("delayNotificationTimeout", DefaultValue = "00:00:05")]
  112. public TimeSpan DelayNotificationTimeout {
  113. get { return (TimeSpan) base[delayNotificationTimeoutProp]; }
  114. set { base[delayNotificationTimeoutProp] = value; }
  115. }
  116. [ConfigurationProperty ("enable", DefaultValue = "True")]
  117. public bool Enable {
  118. get { return (bool) base[enableProp]; }
  119. set { base[enableProp] = value; }
  120. }
  121. [ConfigurationProperty ("enableHeaderChecking", DefaultValue = "True")]
  122. public bool EnableHeaderChecking {
  123. get { return (bool) base[enableHeaderCheckingProp]; }
  124. set { base[enableHeaderCheckingProp] = value; }
  125. }
  126. [ConfigurationProperty ("enableKernelOutputCache", DefaultValue = "True")]
  127. public bool EnableKernelOutputCache {
  128. get { return (bool) base[enableKernelOutputCacheProp]; }
  129. set { base[enableKernelOutputCacheProp] = value; }
  130. }
  131. [ConfigurationProperty ("enableVersionHeader", DefaultValue = "True")]
  132. public bool EnableVersionHeader {
  133. get { return (bool) base[enableVersionHeaderProp]; }
  134. set { base[enableVersionHeaderProp] = value; }
  135. }
  136. [TypeConverter (typeof (TimeSpanSecondsConverter))]
  137. [TimeSpanValidator (MinValueString = "00:00:00")]
  138. [ConfigurationProperty ("executionTimeout", DefaultValue = "00:01:50")]
  139. public TimeSpan ExecutionTimeout {
  140. get { return (TimeSpan) base[executionTimeoutProp]; }
  141. set { base[executionTimeoutProp] = value; }
  142. }
  143. [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
  144. [ConfigurationProperty ("maxRequestLength", DefaultValue = "4096")]
  145. public int MaxRequestLength {
  146. get { return (int) base[maxRequestLengthProp]; }
  147. set { base[maxRequestLengthProp] = value; }
  148. }
  149. [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
  150. [ConfigurationProperty ("maxWaitChangeNotification", DefaultValue = "0")]
  151. public int MaxWaitChangeNotification {
  152. get { return (int) base[maxWaitChangeNotificationProp]; }
  153. set { base[maxWaitChangeNotificationProp] = value; }
  154. }
  155. [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
  156. [ConfigurationProperty ("minFreeThreads", DefaultValue = "8")]
  157. public int MinFreeThreads {
  158. get { return (int) base[minFreeThreadsProp]; }
  159. set { base[minFreeThreadsProp] = value; }
  160. }
  161. [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
  162. [ConfigurationProperty ("minLocalRequestFreeThreads", DefaultValue = "4")]
  163. public int MinLocalRequestFreeThreads {
  164. get { return (int) base[minLocalRequestFreeThreadsProp]; }
  165. set { base[minLocalRequestFreeThreadsProp] = value; }
  166. }
  167. [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue)]
  168. [ConfigurationProperty ("requestLengthDiskThreshold", DefaultValue = "80")]
  169. public int RequestLengthDiskThreshold {
  170. get { return (int) base[requestLengthDiskThresholdProp]; }
  171. set { base[requestLengthDiskThresholdProp] = value; }
  172. }
  173. [ConfigurationProperty ("requireRootedSaveAsPath", DefaultValue = "True")]
  174. public bool RequireRootedSaveAsPath {
  175. get { return (bool) base[requireRootedSaveAsPathProp]; }
  176. set { base[requireRootedSaveAsPathProp] = value; }
  177. }
  178. [ConfigurationProperty ("sendCacheControlHeader", DefaultValue = "True")]
  179. public bool SendCacheControlHeader {
  180. get { return (bool) base[sendCacheControlHeaderProp]; }
  181. set { base[sendCacheControlHeaderProp] = value; }
  182. }
  183. [TypeConverter (typeof (TimeSpanSecondsConverter))]
  184. [ConfigurationProperty ("shutdownTimeout", DefaultValue = "00:01:30")]
  185. public TimeSpan ShutdownTimeout {
  186. get { return (TimeSpan) base[shutdownTimeoutProp]; }
  187. set { base[shutdownTimeoutProp] = value; }
  188. }
  189. [ConfigurationProperty ("useFullyQualifiedRedirectUrl", DefaultValue = "False")]
  190. public bool UseFullyQualifiedRedirectUrl {
  191. get { return (bool) base[useFullyQualifiedRedirectUrlProp]; }
  192. set { base[useFullyQualifiedRedirectUrlProp] = value; }
  193. }
  194. [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
  195. [ConfigurationProperty ("waitChangeNotification", DefaultValue = "0")]
  196. public int WaitChangeNotification {
  197. get { return (int) base[waitChangeNotificationProp]; }
  198. set { base[waitChangeNotificationProp] = value; }
  199. }
  200. protected override ConfigurationPropertyCollection Properties {
  201. get { return properties; }
  202. }
  203. }
  204. }
  205. #endif