| title | IHttpResponse::ResetConnection Method |
|---|---|
| description | Learn how the IHttpResponse::ResetConnection method resets the socket connection immediately, as well as details about its parameters and requirements. |
| ms.date | 10/07/2016 |
| ms.assetid | 7c4a08fd-596f-7ec3-01d3-d780e8373229 |
Resets the socket connection immediately.
virtual VOID ResetConnection(
VOID
) = 0; This method takes no parameters.
VOID.
The ResetConnection method notifies HTTP.sys to trigger an immediate reset of the socket connection with the client.
Note
If you do not return the RQ_NOTIFICATION_FINISH_REQUEST notification after you call the ResetConnection method, the server request-processing pipeline will continue to process the response even though the connection to the client will have been reset.
This method differs from the IHttpResponse::SetNeedDisconnect method, which disconnects the socket after the server finishes processing the current request.
The following code example demonstrates how to use the ResetConnection method to create an HTTP module that terminates the client response. The example module clears the response buffer and inserts a string into the response to return to the client. The example module then calls the ResetConnection method to terminate the response. Finally, the module inserts another string into the response; this method will succeed even though the connection with the client has been reset.
Note
Because the connection with the client is reset, neither of the calls to return a string to the client in this module will send any text to the client.
[!code-cppIHttpResponseResetConnection#1]
Your module must export the RegisterModule function. You can export this function by creating a module definition (.def) file for your project, or you can compile the module by using the /EXPORT:RegisterModule switch. For more information, see Walkthrough: Creating a Request-Level HTTP Module By Using Native Code.
You can optionally compile the code by using the __stdcall (/Gz) calling convention instead of explicitly declaring the calling convention for each function.
| Type | Description |
|---|---|
| Client | - IIS 7.0 on [!INCLUDEwinvista] - IIS 7.5 on Windows 7 - IIS 8.0 on Windows 8 - IIS 10.0 on Windows 10 |
| Server | - IIS 7.0 on [!INCLUDEwinsrv2008] - IIS 7.5 on Windows Server 2008 R2 - IIS 8.0 on Windows Server 2012 - IIS 8.5 on Windows Server 2012 R2 - IIS 10.0 on Windows Server 2016 |
| Product | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 - [!INCLUDEiisexp75], [!INCLUDEiisexp80], [!INCLUDEiisexp100] |
| Header | Httpserv.h |
IHttpResponse Interface
IHttpResponse::SetNeedDisconnect Method
IHttpContext::CancelIo Method