[Mono-devel-list] [PATCH] S.W.UI.Page

Jb Evain mono at evain.net
Wed Jun 1 15:56:08 EDT 2005


Hello, 

Here is a patch for the Page object, so that it behaves more like 
Microsoft's implementation. This is useful when some guy write things like: 

class Client : Page {} 

in order to be able to use the Session in its Client class, without thinking 
about HttpContext.Current. 

Jb 


-------------- next part --------------
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45303)
+++ ChangeLog	(working copy)
@@ -1,3 +1,7 @@
+2005-06-01  Jb Evain  <jbevain at gmail.com>
+
+	* Page.cs: Ensure that the context is setted before accessing the Session.
+
 2005-05-26 Gonzalo Paniagua Javier <gonzalo at ximian.com>
 
 	* AttributeCollection.cs: html-encode attribute values. Fixes
Index: Page.cs
===================================================================
--- Page.cs	(revision 45303)
+++ Page.cs	(working copy)
@@ -364,12 +364,12 @@
 	public virtual HttpSessionState Session
 	{
 		get {
-			if (_context.Session == null)
+			if (Context.Session == null)
 				throw new HttpException ("Session state can only be used " +
 						"when enableSessionState is set to true, either " +
 						"in a configuration file or in the Page directive.");
 
-			return _context.Session;
+			return Context.Session;
 		}
 	}
 


More information about the Mono-devel-list mailing list