Roland Smith
Roland Smith

Reputation: 970

ISAPI Extension

I am writing an ISAPI Extension on Windows 10 using VS 2017 and regular C.

It works great but now I am having trouble with error handling. I am purposely encountering an error to make sure the error message is correct. When the client app (not a browser) and IIS are on the same machine I get my expected error message. When I connect to a copy on another pc, I get the IIS generic html for the 500 status.

Here is where I generate the header:

// Send HTTP headers
SendHttpHeaders(pECB, "500 Internal Server Error", "Content-Type: text/plain\r\n\r\n");

SendHttpHeaders is my wrapper function for sending the headers. I s

Here are the last two lines of code:

pECB->dwHttpStatusCode = HTTP_STATUS_SERVER_ERROR;
return HSE_STATUS_ERROR;

Why am I not getting my custom message?

Upvotes: 0

Views: 336

Answers (1)

T2PS
T2PS

Reputation: 382

Unless IIS is configured otherwise, detailed error messages are only shown to browsers connecting from localhost.

While the linked post describes how to control this behaviour, note that this blocking is intended as a security feature, and (as they mention) depending on your site implementation, this can expose internal details to public view when error conditions are triggered (i.e. ones you are not expecting to make use of this behaviour, such as from a bug). This may or may not be a security concern depending on your operating environment (eg. public internet vs corporate intranet), data sensitivity, etc.

Upvotes: 1

Related Questions