[Mono-bugs] [Bug 79945][Maj] New - LoadPageStateFromPersistenceMedium is called at the first page load

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Nov 16 04:23:20 EST 2006


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 informatique.internet at fiducial.fr.

http://bugzilla.ximian.com/show_bug.cgi?id=79945

--- shadow/79945	2006-11-16 04:23:20.000000000 -0500
+++ shadow/79945.tmp.29312	2006-11-16 04:23:20.000000000 -0500
@@ -0,0 +1,109 @@
+Bug#: 79945
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Sys.Web
+AssignedTo: gonzalo at ximian.com                            
+ReportedBy: informatique.internet at fiducial.fr               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: LoadPageStateFromPersistenceMedium is called at the first page load
+
+Description of Problem:
+This is a regression it use to work with mono 1.1.17. Sometimes you need to
+override LoadPageStateFromPersistenceMedium and
+SavePageStateToPersistenceMedium to custom the viewstate (to compress it
+for example)... LoadPageStateFromPersistenceMedium should'nt be called at
+the first page load or when there's no viewstate in the page
+
+Steps to reproduce the problem:
+1. index.aspx
+<%@ Page Language="C#" Inherits="testweb.index" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+	<title>index</title>
+</head>
+<body>
+	<form id="form1" runat="server">
+		<asp:TextBox id="textBox1" runat="server"/>
+		<asp:Button id="button1" runat="server" OnClick="onButtonClick"/> 
+	</form>
+</body>
+</html>
+
+2. index.aspx.cs
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Text;
+using System.IO;
+
+namespace testweb
+{
+	
+	
+	public class index : Page
+	{
+		protected System.Web.UI.HtmlControls.HtmlForm form1;
+
+		protected System.Web.UI.WebControls.TextBox textBox1;
+
+		protected System.Web.UI.WebControls.Button button1;
+
+		
+		public virtual void onButtonClick(object sender, EventArgs e)
+		{
+			textBox1.Text = "Hello World";
+		}
+		
+		private LosFormatter  _formatter = new LosFormatter();
+		
+		protected override void SavePageStateToPersistenceMedium(object viewState)
+		{
+			Console.WriteLine("Save");
+			StringWriter sw = new StringWriter();
+			if (viewState!=null)
+				_formatter.Serialize(sw, viewState);
+			Page.RegisterHiddenField("__CUSTOMVIEWSTATE",sw.ToString());
+		}
+		
+		protected override object LoadPageStateFromPersistenceMedium()
+		{
+			Console.WriteLine("Load");
+			string vsString = Request.Form["__CUSTOMVIEWSTATE"];
+			if (vsString!="")
+				return _formatter.Deserialize(vsString);
+				else
+				return null;
+		}
+	}
+}
+
+3. run xsp : hit http://localhost:8080
+
+Actual Results:
+
+You see :
+ Load
+ Save
+
+in the console
+
+
+Expected Results:
+Save
+
+How often does this happen? 
+Always
+
+Additional Information:
+It works with MS.NET and Mono 1.1.17


More information about the mono-bugs mailing list