开发者

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?

<%@ Trans开发者_如何学Caction="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"
%>


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


Note that IIS intrinsic properties are disabled by default on Windows 2008 and later versions. Have a look at this link and to this support page from microsoft.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜