FIX: Form with Unchecked Checkboxes Wrongly Processed by ISAPI

ID: Q156914

The information in this article applies to:

SYMPTOMS

When processing a form containing one or more checkboxes that are not checked, using an ISAPI dll via a POST HTTP request, you may see Internet Explore 1.5 in a indeterminate state. With Internet Explorer 2.0 and later, you will see a dialog stating that it does not know how to open the URL.

CAUSE

The code in CHttpServer::HttpExtensionProc() checks to see if the total bytes sent in a case of POST request is zero, and then flags an error. When none of the checkboxes is checked, the number of bytes sent is zero, and the request is flagged as an error.

RESOLUTION

Both methods described below require that you implement the fix described in the following Microsoft Knowledge Base article:

   ARTICLE-ID: Q152365
   TITLE     : FIX: Sending a POST HTTP Request May Cause an Access
                    Violation

Method 1

Have a hidden input element with a default value in the form so that even when both the checkboxes are not checked, the number of bytes sent via POST request is never zero. You could use the change function in the ISAPI dll that handles this request to handle the additional parameter:

   <FORM ACTION=" /scripts/check.dll" METHOD="POST">
   <INPUT TYPE="CHECKBOX" NAME="Check1">Skill<P>
   <INPUT TYPE="HIDDEN" NAME="Def" VALUE="Hidden">
   <INPUT TYPE="SUBMIT">
   </FORM>

METHOD 2

Change ISAPI.CPP, and rebuild the MFC ISAPI Library to fix the bug as follows:

Modify ISAPI.CPP by removing the if statement on line 241:

   if (pECB->cbTotalBytes == 0)
   {
       dwRet = HSE_STATUS_ERROR;
       goto CleanUp;
   }

You can rebuild the MFC ISAPI library by using the MFCISAPI.MAK file in the \MSDEV\MFC\SRC directory. If the ISAPI DLL is built with MFC statically linked (using NAFXIS(D).LIB), you can build the MFC ISAPI library by going to the \MFC\SRC directory and typing:

   NMAKE /f MFCISAPI.MAK DEBUG=1

Specifying DEBUG=1 will build the debug version of the library. Use "DEBUG=1" if you want to build a release build of the library.

If you are building your ISAPI DLL linking to the MFC DLL (using EAFXIS(D).LIB), you can build the MFC ISAPI library by going to the \MFC\SRC directory and typing:

   NMAKE /f MFCISAPI.MAK DEBUG=1 DLL=2

For more information about other options you can specify on the NMAKE Command line, see the README.TXT file in the MSDEV\MFC\SRC directory or look at the MFCISAPI.MAK file.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 4.20.

Additional query words: ISAPI POST Internet Extension DLL

Keywords          : kbISAPI kbMFC kbVC kbVC410bug kbVC420fix iisapi kbbuglist kbfixlist
Version           : 4.1
Platform          : NT WINDOWS
Issue type        : kbbug
Solution Type     : kbfix

Last Reviewed: November 14, 1998