HttpRuntimeConfig.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // System.Web.Configuration.HttpRuntimeConfig
  3. //
  4. // Authors:
  5. // Gonzalo Paniagua Javier ([email protected])
  6. //
  7. // (C) 2003 Novell, Inc. (http://www.novell.com)
  8. //
  9. using System;
  10. using System.CodeDom.Compiler;
  11. using System.Collections;
  12. using System.Configuration;
  13. using System.IO;
  14. using System.Web;
  15. using System.Xml;
  16. namespace System.Web.Configuration
  17. {
  18. sealed class HttpRuntimeConfig
  19. {
  20. public int ExecutionTimeout = 90; // seconds
  21. public int MaxRequestLength = 4096; // KB
  22. public int RequestLengthDiskThreshold = 256; // KB
  23. public bool UseFullyQualifiedRedirectUrl = false;
  24. public int MinFreeThreads = 8;
  25. public int MinLocalRequestFreeThreads = 4;
  26. public int AppRequestQueueLimit = 100;
  27. public bool EnableKernelOutputCache = true;
  28. public bool EnableVersionHeader = true;
  29. public bool RequireRootSaveAsPath = true;
  30. public int IdleTimeout = 20; // minutes
  31. public bool Enable = true;
  32. public string VersionHeader;
  33. /* Only the config. handler should create instances of this. Use GetInstance (context) */
  34. public HttpRuntimeConfig (object p)
  35. {
  36. HttpRuntimeConfig parent = p as HttpRuntimeConfig;
  37. if (parent != null)
  38. Init (parent);
  39. }
  40. static public HttpRuntimeConfig GetInstance (HttpContext context)
  41. {
  42. HttpRuntimeConfig config;
  43. if (context == null)
  44. context = HttpContext.Context;
  45. config = context.GetConfig ("system.web/httpRuntime") as HttpRuntimeConfig;
  46. if (config == null)
  47. throw new Exception ("Configuration error.");
  48. return config;
  49. }
  50. void Init (HttpRuntimeConfig parent)
  51. {
  52. ExecutionTimeout = parent.ExecutionTimeout;
  53. MaxRequestLength = parent.MaxRequestLength;
  54. RequestLengthDiskThreshold = parent.RequestLengthDiskThreshold;
  55. UseFullyQualifiedRedirectUrl = parent.UseFullyQualifiedRedirectUrl;
  56. MinFreeThreads = parent.MinFreeThreads;
  57. MinLocalRequestFreeThreads = parent.MinLocalRequestFreeThreads;
  58. AppRequestQueueLimit = parent.AppRequestQueueLimit;
  59. EnableKernelOutputCache = parent.EnableKernelOutputCache;
  60. EnableVersionHeader = parent.EnableVersionHeader;
  61. RequireRootSaveAsPath = parent.RequireRootSaveAsPath;
  62. IdleTimeout = parent.IdleTimeout;
  63. Enable = parent.Enable;
  64. }
  65. }
  66. }