AnonymousIdentificationSection.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. //
  2. // System.Web.Configuration.AnonymousIdentificationSection.cs
  3. //
  4. // Authors:
  5. // Lluis Sanchez Gual ([email protected])
  6. //
  7. // (C) 2004 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.Configuration;
  32. using System.Web.Security;
  33. using System.ComponentModel;
  34. namespace System.Web.Configuration
  35. {
  36. public sealed class AnonymousIdentificationSection: InternalSection
  37. {
  38. /* static ConfigurationPropertyCollection properties;
  39. static ConfigurationProperty enabledProp;
  40. static ConfigurationProperty cookieNameProp;
  41. static ConfigurationProperty cookieTimeoutProp;
  42. static ConfigurationProperty cookiePathProp;
  43. static ConfigurationProperty cookieRequireSSLProp;
  44. static ConfigurationProperty cookieSlidingExpirationProp;
  45. static ConfigurationProperty cookieProtectionProp;
  46. static ConfigurationProperty cookilessProp;
  47. static ConfigurationProperty domainProp;
  48. */
  49. static AnonymousIdentificationSection ()
  50. {
  51. /* enabledProp = new ConfigurationProperty ("enabled", typeof(bool), false);
  52. cookieNameProp = new NonEmptyStringConfigurationProperty ("cookieName", ".ASPXANONYMOUS", ConfigurationPropertyFlags.None);
  53. cookieTimeoutProp = new TimeSpanConfigurationProperty ("cookieTimeout", new TimeSpan (69,10,40,0), TimeSpanSerializedFormat.Minutes, TimeSpanPropertyFlags.AllowInfinite | TimeSpanPropertyFlags.ProhibitZero, ConfigurationPropertyFlags.None);
  54. cookiePathProp = new NonEmptyStringConfigurationProperty ("cookiePath", "/", ConfigurationPropertyFlags.None);
  55. cookieRequireSSLProp = new ConfigurationProperty ("cookieRequireSSL", typeof(bool), false);
  56. cookieSlidingExpirationProp = new ConfigurationProperty ("cookieSlidingExpiration", typeof(bool), true);
  57. cookieProtectionProp = new ConfigurationProperty ("cookieProtection", typeof(CookieProtection), CookieProtection.Validation);
  58. cookilessProp = new ConfigurationProperty ("cookiless", typeof(HttpCookieMode), HttpCookieMode.UseDeviceProfile);
  59. domainProp = new ConfigurationProperty ("domain", typeof(string), null);
  60. properties = new ConfigurationPropertyCollection ();
  61. properties.Add (enabledProp);
  62. properties.Add (cookieNameProp);
  63. properties.Add (cookieTimeoutProp);
  64. properties.Add (cookiePathProp);
  65. properties.Add (cookieRequireSSLProp);
  66. properties.Add (cookieSlidingExpirationProp);
  67. properties.Add (cookieProtectionProp);
  68. properties.Add (cookilessProp);
  69. properties.Add (domainProp);
  70. */ }
  71. [ConfigurationProperty ("cookieless", DefaultValue = HttpCookieMode.UseCookies)]
  72. public HttpCookieMode Cookieless {
  73. get { return (HttpCookieMode) base ["cookieless"]; }
  74. set { base ["cookieless"] = value; }
  75. }
  76. [StringValidator (MaxLength = 1)]
  77. [ConfigurationProperty ("cookieName", DefaultValue = ".ASPXANONYMOUS")]
  78. public string CookieName {
  79. get { return (string) base ["cookieName"]; }
  80. set { base ["cookieName"] = value; }
  81. }
  82. [StringValidator (MaxLength = 1)]
  83. [ConfigurationProperty ("cookiePath", DefaultValue = "/")]
  84. public string CookiePath {
  85. get { return (string) base ["cookiePath"]; }
  86. set { base ["cookiePath"] = value; }
  87. }
  88. [ConfigurationProperty ("cookieProtection", DefaultValue = CookieProtection.Validation)]
  89. public CookieProtection CookieProtection {
  90. get { return (CookieProtection) base ["cookieProtection"]; }
  91. set { base ["cookieProtection"] = value; }
  92. }
  93. [ConfigurationProperty ("cookieRequireSSL", DefaultValue = false)]
  94. public bool CookieRequireSSL {
  95. get { return (bool) base ["cookieRequireSSL"]; }
  96. set { base ["cookieRequireSSL"] = value; }
  97. }
  98. [ConfigurationProperty ("cookieSlidingExpiration", DefaultValue = true)]
  99. public bool CookieSlidingExpiration {
  100. get { return (bool) base ["cookieSlidingExpiration"]; }
  101. set { base ["cookieSlidingExpiration"] = value; }
  102. }
  103. [ConfigurationValidator (typeof(PositiveTimeSpanValidator))]
  104. [TypeConverter (typeof(TimeSpanMinutesOrInfiniteConverter))]
  105. [ConfigurationProperty ("cookieTimeout", DefaultValue = "69.10:40:00")]
  106. public TimeSpan CookieTimeout {
  107. get { return (TimeSpan) base ["cookieTimeout"]; }
  108. set { base ["cookieTimeout"] = value; }
  109. }
  110. [ConfigurationProperty ("domain", DefaultValue = "")]
  111. public string Domain {
  112. get { return (string) base ["domain"]; }
  113. set { base ["domain"] = value; }
  114. }
  115. [ConfigurationProperty ("enabled", DefaultValue = false)]
  116. public bool Enabled {
  117. get { return (bool) base ["enabled"]; }
  118. set { base ["enabled"] = value; }
  119. }
  120. /* protected override ConfigurationPropertyCollection Properties {
  121. get { return properties; }
  122. }
  123. */
  124. }
  125. }
  126. #endif