Calling HttpContext::PostCompletion method twice may cause crash

Summary

Consider the following scenario:

You are developing an IIS module which calls PostCompletion twice. In this scenario, on the second call to PostCompletion, your web application crashes with an Access Violation.

Cause

PostCompletion indicates that an HTTPRequest has completed. Thus the HttpContext object is no longer available so the second call to the HttpContext object's PostCompletion method causes an Access Violation.

More Information

IHttpContext::PostCompletion Method
http://msdn.microsoft.com/en-us/library/ms692997(v=vs.90).aspx

If you are calling PostCompletion then put a guard (e.g.: check if HttpContext is not null) around it to avoid crash if it is invoked automatically.

Propriétés

ID d'article : 2824214 - Dernière mise à jour : 30 avr. 2013 - Révision : 1

Commentaires