[Mono-bugs] [Bug 75818][Maj] New - Cannot access Sessions within classes

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Aug 14 23:45:04 EDT 2005

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by reinaldo at dinamustec.com.br.


--- shadow/75818	2005-08-14 23:45:04.000000000 -0400
+++ shadow/75818.tmp.8145	2005-08-14 23:45:04.000000000 -0400
@@ -0,0 +1,51 @@
+Bug#: 75818
+Product: Mono: Class Libraries
+Version: 1.1
+OS Details: Windows 2003
+Status: NEW   
+Priority: Major
+Component: Sys.Web
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: reinaldo at dinamustec.com.br               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Cannot access Sessions within classes
+I created a simple test project to demostrate the problem:
+If a created a class named Class1 like this:
+  public class Class1 : System.Web.UI.Page
+  {
+    public string getme()
+    {
+      return Session["whereareyou"].ToString();
+    }
+  }
+And a WebForm with a button and a label. When I click the button I try to
+store some value in the session "whereareyou" and retrive this value
+through the Class1 method getme():
+private void Button1_Click(object sender, System.EventArgs e)
+  Session["whereareyou"] = "I am Here!"
+  Class1 a = new Class1();
+  this.Label1.Text = a.getme();
+Then I get the error: 
+System.NullReferenceException: Object reference not set to an instance of
+an object
+in <0x0000e> System.Web.UI.Page:get_Session ()
+in <0x00039> monotest.Class1:getme ()
+This error does not occurr in IIS.

More information about the mono-bugs mailing list