HttpSessionState.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. //
  2. // System.Web.SessionState.HttpSessionState
  3. //
  4. // Authors:
  5. // Gonzalo Paniagua Javier ([email protected])
  6. //
  7. // (C) 2002 Ximian, Inc (http://www.ximian.com)
  8. //
  9. using System;
  10. using System.Collections;
  11. using System.Collections.Specialized;
  12. namespace System.Web.SessionState {
  13. public sealed class HttpSessionState : ICollection, IEnumerable
  14. {
  15. private int _codePage;
  16. private NameValueCollection _state; //FIXME: it should be a ManagementNamedValueCollection
  17. //public int CodePage -> compatibility with ASP
  18. public HttpSessionState Contents
  19. {
  20. get { return this; }
  21. }
  22. public int Count
  23. {
  24. get { return _state.Count; }
  25. }
  26. [MonoTODO]
  27. public bool IsCookieless
  28. {
  29. get { throw new NotImplementedException (); }
  30. }
  31. [MonoTODO]
  32. public bool IsNewSession
  33. {
  34. get { throw new NotImplementedException (); }
  35. }
  36. [MonoTODO]
  37. public bool IsReadOnly
  38. {
  39. get { throw new NotImplementedException (); }
  40. }
  41. [MonoTODO]
  42. public bool IsSynchronized
  43. {
  44. get { throw new NotImplementedException (); }
  45. }
  46. public object this [string key]
  47. {
  48. get { return _state [key]; }
  49. set { _state [key] = (string) value; }
  50. }
  51. public object this [int index]
  52. {
  53. get { return _state [index]; }
  54. set {
  55. string key = _state.Keys [index];
  56. _state [key] = (string) value;
  57. }
  58. }
  59. public NameObjectCollectionBase.KeysCollection Keys
  60. {
  61. get { return _state.Keys; }
  62. }
  63. [MonoTODO]
  64. public int LCID
  65. {
  66. get { throw new NotImplementedException (); }
  67. set { throw new NotImplementedException (); }
  68. }
  69. [MonoTODO]
  70. public SessionStateMode Mode
  71. {
  72. get { throw new NotImplementedException (); }
  73. }
  74. [MonoTODO]
  75. public string SessionID
  76. {
  77. get { throw new NotImplementedException (); }
  78. }
  79. [MonoTODO]
  80. public HttpStaticObjectsCollection StaticObjects
  81. {
  82. get { throw new NotImplementedException (); }
  83. }
  84. public object SyncRoot
  85. {
  86. get { return this; }
  87. }
  88. [MonoTODO]
  89. public int Timeout
  90. {
  91. get { throw new NotImplementedException (); }
  92. set { throw new NotImplementedException (); }
  93. }
  94. [MonoTODO]
  95. public void Abandon ()
  96. {
  97. throw new NotImplementedException ();
  98. }
  99. public void Add (string name, object value)
  100. {
  101. if (_state == null)
  102. _state = new NameValueCollection ();
  103. _state.Add (name, (string) value);
  104. }
  105. public void Clear ()
  106. {
  107. if (_state != null)
  108. _state.Clear ();
  109. }
  110. public void CopyTo (Array array, int index)
  111. {
  112. if (_state == null)
  113. _state = new NameValueCollection ();
  114. _state.CopyTo (array, index);
  115. }
  116. public IEnumerator GetEnumerator ()
  117. {
  118. if (_state == null)
  119. _state = new NameValueCollection ();
  120. return _state.GetEnumerator ();
  121. }
  122. public void Remove (string name)
  123. {
  124. if (_state != null)
  125. _state.Remove (name);
  126. }
  127. public void RemoveAll ()
  128. {
  129. if (_state != null)
  130. foreach (string key in _state.AllKeys)
  131. _state.Remove (key);
  132. }
  133. [MonoTODO("Implement ManagementNameValueCollection")]
  134. public void RemoveAt (int index)
  135. {
  136. throw new NotImplementedException ();
  137. //if (_state != null)
  138. // _state.RemoveAt (index);
  139. }
  140. }
  141. }