CHttpServer::OnParseError

virtual BOOL OnParseError( CHttpServerContext* pCtxt**, int** nCause );

Return Value

Nonzero error is successfully parsed; otherwise 0.

Parameters

pCtxt

A pointer to a CHttpServerContext object that contains an EXTENSION_CONTROL_BLOCK structure function dwHttpStatusCode. These status values are:

  • HTTP_STATUS_BAD_REQUEST

  • HTTP_STATUS_AUTH_REQUIRED

  • HTTP_STATUS_FORBIDDEN

  • HTTP_STATUS_NOT_FOUND

  • HTTP_STATUS_SERVER_ERROR

  • HTTP_STATUS_NOT_IMPLEMENTED

nCause

The cause of the error.  Can be one of the following values:

Enum type Description
callOK OnParseError handled the error.
callParamRequired A required parameter was missing.
callBadParamCount There were too many or too few parameters.
callBadCommand The command name was not found.
callNoStackSpace No stack space was available.
callNoStream No CHtmlStream was available.
callMissingQuote A parameter is missing a quote mark.
callMissingParams No parameters were available.
callBadParam A parameter had a bad format.

Remarks

Called by the framework to parse errors. Once the error is identified, the message associated with the cause of the error is returned to the client either in an HTML stream or in a CHttpServerContext::WriteClient message.

Override this member function to customize the error parsing.

Example

The following code demonstrates how to handle various parsing errors in the ISAPI and notify users about them.

BOOL CMfcCookieExtension::OnParseError(CHttpServerContext* pCtxt, int nCause)
{
    // TODO: Add your specialized code here and/or call the base class
    ISAPITRACE1 ("Parser: %d\n", nCause);
    switch (nCause)
    {
        case callOK:
            ISAPITRACE ("No errors\n");
        break;

        case callParamRequired:
            *pCtxt << "A required parameter was missing<br>";
        break;

        case callBadParamCount:
            *pCtxt <<"There were too many or too few parameters<br>";
        break;

        case callBadCommand:
            *pCtxt <<"The command name was not found<br>";
        break;

        case callNoStackSpace:
            *pCtxt <<"No stack space was available<br>";
        break;

        case callNoStream:
            *pCtxt <<"No CHtmlStream was available<br>";
        break;

        case callMissingQuote:
            *pCtxt <<"A parameter had a bad format <br>";
        break;

        case callMissingParams:
            *pCtxt <<"No parameters were available <br>";
        break;

        case callBadParam:
            *pCtxt <<"A parameter had a bad format (ie, only one quote) <br>";
        break;
    }

   // Return TRUE, because error was handled.
    return  TRUE;
}

CHttpServer OverviewClass MembersHierarchy Chart