Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Response.Redirect/End does not commit transaction in Classic ASP on IIS7

My OnTransactionCommit method is not being called on IIS 7 when I use Response.Redirect or Response.End. The code below works as expected on IIS 6 ("Comitting..." is output after "OK") but on IIS 7 I only get "OK" unless I remove the Response.End. The OnTransactionAbort method is called on both versions of IIS if I replace Response.End with Err.Raise.

I have tried changing the pipeline to Classic but that had no effect. Can anyone shed any light on what setting I need to change to get this method to execute?

<%@ Transaction="Supported" Language="VBScript" %>
<% Option Explicit %>
<%
'Called by context unless transaction is aborted
Sub OnTransactionCommit()
    Response.Write("Commiting...")
    Response.Flush
End Sub

'Called by context when transaction is aborted
Sub OnTransactionAbort()
    Response.Write("Aborting...")
    Response.Flush
End Sub

Response.Write("OK<br/>")
Response.Flush
Response.End
'Err.Raise 1, "test"
%>
like image 761
Andy Kershaw Avatar asked Nov 14 '22 19:11

Andy Kershaw


1 Answers

Calling Response.End or Response.Redirect probably throws a ThreadAbortedException, as calling it in .NET does (IIS7 and .NET are tightly integrated).

like image 138
Erik A. Brandstadmoen Avatar answered Nov 17 '22 05:11

Erik A. Brandstadmoen