FIX: Form with Unchecked Checkboxes Wrongly Processed by ISAPI

Last reviewed: October 29, 1997
Article ID: Q156914
The information in this article applies to:
  • The Microsoft Foundation Classes (MFC), included with: Microsoft Visual C++, 32-bit Edition, version 4.1

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 : IISAPI MfcISAPI vcbuglist410 vcfixlist420 kbbuglist kbfixlist
Technology : kbMfc kbInetDev
Version : 4.1
Platform : NT WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.