[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.
http://bugzilla.ximian.com/show_bug.cgi?id=51703
--- 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
+Resolution:
+Severity:
+Priority: Normal
+Component: System.Web
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: biomech@uscm.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+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
+Response.Redirect("/test2.aspx",true);
+
+ string testValue = Request.Cookies["Test"].Values["Value"];
+ }
+
+</script>
+
+( 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
+2.
+3.
+
+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>
+System.Runtime.Serialization.Formatters.Binary.ObjectWriter:GetObjectData
+(object,System.Runtime.Serialization.Formatters.Binary.ObjectWriter/TypeMet
+adata&,object[]&)
+in <0x00075>
+System.Runtime.Serialization.Formatters.Binary.ObjectWriter:WriteObject
+(System.IO.BinaryWriter,long,object)
+in <0x00170>
+System.Runtime.Serialization.Formatters.Binary.ObjectWriter:WriteObjectInst
+ance (System.IO.BinaryWriter,object,bool)
+in <0x0003e>
+System.Runtime.Serialization.Formatters.Binary.ObjectWriter:WriteQueuedObje
+cts (System.IO.BinaryWriter)
+in <0x0004b>
+System.Runtime.Serialization.Formatters.Binary.ObjectWriter:WriteObjectGrap
+h (System.IO.BinaryWriter,object,System.Runtime.Remoting.Messaging.Header
+[])
+in <0x001c5>
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Serialize
+(System.IO.Stream,object,System.Runtime.Remoting.Messaging.Header[])
+in <0x00019>
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Serialize
+(System.IO.Stream,object)
+in <0x00091>
+System.Runtime.Remoting.Channels.CADSerializer:SerializeObject (object)
+in <0x001ab>
+System.Runtime.Remoting.Messaging.CADMethodReturnMessage:.ctor
+(System.Runtime.Remoting.Messaging.IMethodReturnMessage)
+in <0x00060>
+System.Runtime.Remoting.Messaging.CADMethodReturnMessage:Create
+(System.Runtime.Remoting.Messaging.IMessage)
+in <0x0008e> System.AppDomain:ProcessMessageInDomain (byte
+[],System.Runtime.Remoting.Messaging.CADMethodCallMessage,byte[]
+&,System.Runtime.Remoting.Messaging.CADMethodReturnMessage&)
+in <0x0008d> (wrapper remoting-invoke-with-check)
+System.AppDomain:ProcessMessageInDomain (byte
+[],System.Runtime.Remoting.Messaging.CADMethodCallMessage,byte[]
+&,System.Runtime.Remoting.Messaging.CADMethodReturnMessage&)
+in <0x0004b>
+System.Runtime.Remoting.Channels.CrossAppDomainSink:ProcessMessageInDomain
+(byte[],System.Runtime.Remoting.Messaging.CADMethodCallMessage)
+
+
+Exception rethrown at [0]:
+
+in <0x00175> System.Runtime.Remoting.Proxies.RealProxy:PrivateInvoke
+(System.Runtime.Remoting.Proxies.RealProxy,System.Runtime.Remoting.Messagin
+g.IMessage,System.Exception&,object[]&)
+in (unmanaged) /usr/lib/libmono.so.0(mono_raise_exception+0x1b)
+[0x4007fab7]
+in (unmanaged) /usr/lib/libmono.so.0 [0x40090605]
+in <0x00044> (wrapper remoting-invoke) System.AppDomain:DoCallBack
+(System.CrossAppDomainDelegate)
+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.