Calling HttpContext::PostCompletion method twice may cause crash

Applies to: Internet Information Services 8.0


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.


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

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.