SessionStateModule.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //
  2. // System.Web.SessionState.SesionStateModule
  3. //
  4. // Authors:
  5. // Gonzalo Paniagua Javier ([email protected])
  6. //
  7. // (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
  8. //
  9. using System.Web;
  10. namespace System.Web.SessionState
  11. {
  12. [MonoTODO]
  13. public sealed class SessionStateModule : IHttpModule
  14. {
  15. static SessionConfig config;
  16. Type handlerType;
  17. object handler;
  18. class SessionInProcHandler {}
  19. public SessionStateModule ()
  20. {
  21. }
  22. public void Dispose ()
  23. {
  24. }
  25. [MonoTODO]
  26. public void Init (HttpApplication app)
  27. {
  28. if (config == null) {
  29. config = (SessionConfig) HttpContext.GetAppConfig ("system.web/sessionState");
  30. if (config == null)
  31. config = new SessionConfig (null);
  32. if (config.Mode == SessionStateMode.StateServer ||
  33. config.Mode == SessionStateMode.SQLServer)
  34. throw new NotSupportedException ("Only Off and InProc modes supported.");
  35. if (config.Mode == SessionStateMode.InProc) {
  36. handlerType = typeof (SessionInProcHandler);
  37. app.AddOnAcquireRequestStateAsync (
  38. new BeginEventHandler (OnBeginAcquireState),
  39. new EndEventHandler (OnEndAcquireState));
  40. app.ReleaseRequestState += new EventHandler (OnReleaseRequestState);
  41. app.EndRequest += new EventHandler (OnEndRequest);
  42. }
  43. }
  44. if (handlerType != null && handler == null)
  45. handler = Activator.CreateInstance (handlerType);
  46. }
  47. void OnReleaseRequestState (object o, EventArgs args)
  48. {
  49. }
  50. void OnEndRequest (object o, EventArgs args)
  51. {
  52. }
  53. IAsyncResult OnBeginAcquireState (object o, EventArgs args, AsyncCallback cb, object data)
  54. {
  55. return null;
  56. }
  57. void OnEndAcquireState (IAsyncResult result)
  58. {
  59. }
  60. public event EventHandler Start;
  61. public event EventHandler End;
  62. }
  63. }