2 // System.Web.Configuration.AnonymousIdentificationSection.cs
5 // Lluis Sanchez Gual (lluis@novell.com)
7 // (C) 2004 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 using System.Configuration;
35 using System.Web.Security;
36 using System.ComponentModel;
38 namespace System.Web.Configuration
40 public sealed class AnonymousIdentificationSection: InternalSection
42 /* static ConfigurationPropertyCollection properties;
43 static ConfigurationProperty enabledProp;
44 static ConfigurationProperty cookieNameProp;
45 static ConfigurationProperty cookieTimeoutProp;
46 static ConfigurationProperty cookiePathProp;
47 static ConfigurationProperty cookieRequireSSLProp;
48 static ConfigurationProperty cookieSlidingExpirationProp;
49 static ConfigurationProperty cookieProtectionProp;
50 static ConfigurationProperty cookilessProp;
51 static ConfigurationProperty domainProp;
53 static AnonymousIdentificationSection ()
55 /* enabledProp = new ConfigurationProperty ("enabled", typeof(bool), false);
56 cookieNameProp = new NonEmptyStringConfigurationProperty ("cookieName", ".ASPXANONYMOUS", ConfigurationPropertyFlags.None);
57 cookieTimeoutProp = new TimeSpanConfigurationProperty ("cookieTimeout", new TimeSpan (69,10,40,0), TimeSpanSerializedFormat.Minutes, TimeSpanPropertyFlags.AllowInfinite | TimeSpanPropertyFlags.ProhibitZero, ConfigurationPropertyFlags.None);
58 cookiePathProp = new NonEmptyStringConfigurationProperty ("cookiePath", "/", ConfigurationPropertyFlags.None);
59 cookieRequireSSLProp = new ConfigurationProperty ("cookieRequireSSL", typeof(bool), false);
60 cookieSlidingExpirationProp = new ConfigurationProperty ("cookieSlidingExpiration", typeof(bool), true);
61 cookieProtectionProp = new ConfigurationProperty ("cookieProtection", typeof(CookieProtection), CookieProtection.Validation);
62 cookilessProp = new ConfigurationProperty ("cookiless", typeof(HttpCookieMode), HttpCookieMode.UseDeviceProfile);
63 domainProp = new ConfigurationProperty ("domain", typeof(string), null);
65 properties = new ConfigurationPropertyCollection ();
66 properties.Add (enabledProp);
67 properties.Add (cookieNameProp);
68 properties.Add (cookieTimeoutProp);
69 properties.Add (cookiePathProp);
70 properties.Add (cookieRequireSSLProp);
71 properties.Add (cookieSlidingExpirationProp);
72 properties.Add (cookieProtectionProp);
73 properties.Add (cookilessProp);
74 properties.Add (domainProp);
77 [ConfigurationProperty ("cookieless", DefaultValue = HttpCookieMode.UseCookies)]
\r
78 public HttpCookieMode Cookieless {
79 get { return (HttpCookieMode) base ["cookieless"]; }
80 set { base ["cookieless"] = value; }
83 [StringValidator (MaxLength = 1)]
\r
84 [ConfigurationProperty ("cookieName", DefaultValue = ".ASPXANONYMOUS")]
\r
85 public string CookieName {
86 get { return (string) base ["cookieName"]; }
87 set { base ["cookieName"] = value; }
90 [StringValidator (MaxLength = 1)]
\r
91 [ConfigurationProperty ("cookiePath", DefaultValue = "/")]
\r
92 public string CookiePath {
93 get { return (string) base ["cookiePath"]; }
94 set { base ["cookiePath"] = value; }
97 [ConfigurationProperty ("cookieProtection", DefaultValue = CookieProtection.Validation)]
\r
98 public CookieProtection CookieProtection {
99 get { return (CookieProtection) base ["cookieProtection"]; }
100 set { base ["cookieProtection"] = value; }
103 [ConfigurationProperty ("cookieRequireSSL", DefaultValue = false)]
\r
104 public bool CookieRequireSSL {
105 get { return (bool) base ["cookieRequireSSL"]; }
106 set { base ["cookieRequireSSL"] = value; }
109 [ConfigurationProperty ("cookieSlidingExpiration", DefaultValue = true)]
\r
110 public bool CookieSlidingExpiration {
111 get { return (bool) base ["cookieSlidingExpiration"]; }
112 set { base ["cookieSlidingExpiration"] = value; }
115 [ConfigurationValidator (typeof(PositiveTimeSpanValidator))]
\r
116 [TypeConverter (typeof(TimeSpanMinutesOrInfiniteConverter))]
\r
117 [ConfigurationProperty ("cookieTimeout", DefaultValue = "69.10:40:00")]
\r
118 public TimeSpan CookieTimeout {
119 get { return (TimeSpan) base ["cookieTimeout"]; }
120 set { base ["cookieTimeout"] = value; }
123 [ConfigurationProperty ("domain", DefaultValue = "")]
\r
124 public string Domain {
125 get { return (string) base ["domain"]; }
126 set { base ["domain"] = value; }
129 [ConfigurationProperty ("enabled", DefaultValue = false)]
\r
130 public bool Enabled {
131 get { return (bool) base ["enabled"]; }
132 set { base ["enabled"] = value; }
135 /* protected override ConfigurationPropertyCollection Properties {
136 get { return properties; }