[Mono-bugs] [Bug 78177][Nor] New - Server.Transfer don't preserve querystring parameters while it should

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Apr 24 11:18:27 EDT 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=78177

--- shadow/78177	2006-04-24 11:18:27.000000000 -0400
+++ shadow/78177.tmp.4901	2006-04-24 11:18:27.000000000 -0400
@@ -0,0 +1,111 @@
+Bug#: 78177
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Web
+AssignedTo: gonzalo at ximian.com                            
+ReportedBy: informatique.internet at fiducial.fr               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Server.Transfer don't preserve querystring parameters while it should
+
+Description of Problem:
+Using  Server.Transfer("new url", true) doesn't transfer the querystring to
+the new url
+
+
+Steps to reproduce the problem:
+1. Create a webform1.aspx.cx
+with this in page load:
+		private void Page_Load(object sender, System.EventArgs e)
+
+		{
+			Server.Transfer("WebForm2.aspx",true);
+
+
+		}
+2. 
+    Create a webForm2.Aspx.cs with this in page load:
+protected Label label1;
+
+
+
+	
+
+		private void Page_Load(object sender, System.EventArgs e)
+
+		{
+			label1.Text="ID :"+ Request.QueryString["ID"];
+
+
+		}
+
+
+3. Run xsp, and access to http://localhost:8080/WebForm1.aspx?ID=Test
+
+Actual Results:
+ID=
+
+Expected Results:
+ID=Test
+
+How often does this happen? 
+Always
+
+Additional Information:
+Here's a quick patch which solve the issue:
+Index: System.Web/HttpServerUtility.cs
+===================================================================
+--- System.Web/HttpServerUtility.cs     (révision 59814)
++++ System.Web/HttpServerUtility.cs     (copie de travail)
+@@ -106,16 +106,15 @@
+                        } else {
+                                query = "";
+                        }
+-
++
+                        HttpRequest request = context.Request;
+                        HttpResponse response = context.Response;
+-
++
+                        string oldQuery = request.QueryStringRaw;
+                        request.QueryStringRaw = query;
+
+-                       WebROCollection oldForm = null;
++                       WebROCollection oldForm = request.Form as
+WebROCollection;
+                        if (!preserveQuery) {
+-                               oldForm = request.Form as WebROCollection;
+                                request.SetForm (new WebROCollection ());
+                        }
+
+@@ -125,9 +124,17 @@
+
+                        string oldFilePath = request.FilePath;
+                        request.SetCurrentExePath (UrlUtils.Combine
+(request.BaseVirtualDir, path));
++
++                       if (preserveQuery)
++                       {
++                               request.SetForm (oldForm);
++                               if (query=="")
++                                       request.QueryStringRaw = oldQuery;
++                       }
+                        IHttpHandler handler =
+context.ApplicationInstance.GetHandler (context);
+                        TextWriter previous = null;
+                        try {
++                               request.SetCurrentExePath (oldFilePath);
+                                previous = response.SetTextWriter (output);
+                                if (!(handler is IHttpAsyncHandler)) {
+                                        handler.ProcessRequest (context);
+
+
+Please feel free to commit, but it may be a little bit dirty...


More information about the mono-bugs mailing list