Microsoft KB Archive/938361

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

Article ID: 938361

Article Last Modified on 7/5/2007

-

APPLIES TO


 * Microsoft Visual Studio 2005 Professional Edition
 * Microsoft Visual Studio 2005 Standard Edition

-





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(&quot;Test&quot;); //   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(&quot;Test&quot;); //   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,&quot;Dummy: My Header&quot;); // EndContent(pCtxt); }
 * pCtxt << _T(&quot;Test&quot;);



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.

Keywords: kbtshoot kbprb KB938361

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.