Article ID: 938361 - Last Review: July 5, 2007 - Revision: 1.0

Extra carriage return characters and extra line feed characters appear when you convert an MFC ISAPI based-project in Visual Studio 2005

SYMPTOMS

When you convert an MFC ISAPI-based project that is created in an early version of Visual Studio to Microsoft Visual Studio 2005, an extra set of carriage return characters (/r) and line feed characters (/n) appears. This problem occurs when you use the CHttpServerContext class.

For example, this problem occurs you modify a default MFC ISAPI project, as follows:
void CTestIISDLLExtension::Default(CHttpServerContext* pCtxt, void* pVoid, DWORD dwBytes)
{
//    StartContent(pCtxt);
//    WriteTitle(pCtxt);
      *pCtxt << _T("Test");
//    EndContent(pCtxt);
}

WORKAROUND

To work around this problem, add a header to the return stream.

For example, the project may contain the following code:
void CTestIISDLLExtension::Default(CHttpServerContext* pCtxt, void* pVoid, DWORD dwBytes)
{
//    StartContent(pCtxt);
//    WriteTitle(pCtxt);
      *pCtxt << _T("Test");
//    EndContent(pCtxt);
}
To work around this problem, change the code to the following code:
void CTestIISDLLExtension::Default(CHttpServerContext* pCtxt, void* pVoid, DWORD dwBytes)
{
// StartContent(pCtxt);
// WriteTitle(pCtxt);
this->AddHeader(pCtxt,"Dummy: My Header");
*pCtxt << _T("Test");
// EndContent(pCtxt);
}

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Keywords: 
kbtshoot kbprb KB938361

Note: This article is from Microsoft Knowledage Base


How we have helped PC users like you

In the News: Read More In ...

Related problems posted by other users

more...