[Mono-bugs] [Bug 51703][Nor] New - Response.Redirect() doesn't stop code execution on the current page

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 4 Dec 2003 11:24:44 -0500 (EST)

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 biomech@uscm.net.


--- shadow/51703	2003-12-04 11:24:43.000000000 -0500
+++ shadow/51703.tmp.10568	2003-12-04 11:24:43.000000000 -0500
@@ -0,0 +1,133 @@
+Bug#: 51703
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: System.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: biomech@uscm.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Response.Redirect() doesn't stop code execution on the current page
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+When using Response.Redirect(string) or Response.Redirect(string, true), 
+buffers are flushed nicely but page processing continues. In particular, 
+when working with cookies, this throws an HttpException. (tested using 
+Mono 0.29 / mod_mono 0.6 / mod-mono-server 0.8)
+<%@Page Language="c#" %>
+<script runat="server">
+        void Page_Load (Object sender, EventArgs e) {
+                if (Request.Cookies["Test"] == null)
+                        Response.Redirect("/redirected.aspx"); // OR 
+                string testValue = Request.Cookies["Test"].Values["Value"];
+        }
+( redirected.aspx can be anything )
+Please note that the above aspx does not throw an exception when served by 
+IIS with MS.NET framework 1.1, and the redirect succeeds.
+If the "string testValue = ..." line is commented, the page succeeds when 
+served by mod_mono and mono 0.29 framework.
+Steps to reproduce the problem:
+1. Attempt to access the ASPX included
+Actual Results:
+System.Runtime.Serialization.SerializationException: Type 
+System.Web.HttpException is not marked as Serializable and does not 
+implement ISerializable.
+Server stack trace:
+in <0x001e4> 
+in <0x00075> 
+in <0x00170> 
+ance (System.IO.BinaryWriter,object,bool)
+in <0x0003e> 
+cts (System.IO.BinaryWriter)
+in <0x0004b> 
+h (System.IO.BinaryWriter,object,System.Runtime.Remoting.Messaging.Header
+in <0x001c5> 
+in <0x00019> 
+in <0x00091> 
+System.Runtime.Remoting.Channels.CADSerializer:SerializeObject (object)
+in <0x001ab> 
+in <0x00060> 
+in <0x0008e> System.AppDomain:ProcessMessageInDomain (byte
+in <0x0008d> (wrapper remoting-invoke-with-check) 
+System.AppDomain:ProcessMessageInDomain (byte
+in <0x0004b> 
+Exception rethrown at [0]:
+in <0x00175> System.Runtime.Remoting.Proxies.RealProxy:PrivateInvoke 
+in (unmanaged) /usr/lib/libmono.so.0(mono_raise_exception+0x1b) 
+in (unmanaged) /usr/lib/libmono.so.0 [0x40090605]
+in <0x00044> (wrapper remoting-invoke) System.AppDomain:DoCallBack 
+in <0x00032> (wrapper remoting-invoke-with-check) 
+System.AppDomain:DoCallBack (System.CrossAppDomainDelegate)
+in <0x00140> Mono.ASPNET.Worker:Run (object)
+Expected Results:
+The aspx does not throw an exception when served by IIS with MS.NET 
+framework 1.1, and the redirect succeeds. This should be the same in mono.
+How often does this happen? 
+This could happen anytime code following a conditional Response.Redirect 
+depends on the redirect terminating the page's execution. Specifically, 
+any exception can be thrown if uninitialized or unallocated resources are 
+being accessed after the redirect.
+Additional Information:
+The MS.NET class reference indicates that Redirect eventually calls the 
+End method which should throw a ThreadAbortException. My guess is that the 
+thread processing the page should be aborted, thus terminating any further 
+execution of the page. Mono may not be doing this.