IIS 7 and Above
Modify HTML response by native module with IIS 7 or above
Last post Apr 18, 2018 09:59 AM by Bhavesh___
Apr 16, 2018 07:12 AM|Bhavesh___|LINK
So I tried troubleshooting and commented the line which replaces text with new text. This happens even if I dont modify the content of the page and simply write the same content back i.e. modifying 'pChunk->FromMemory.pBuffer'
Is there something wrong with the approach? I can provide code if required.
I also tried using WriteEntityChunkByReference instead of directly modifying 'pChunk->FromMemory.pBuffer'. But it has same issue.
Apr 18, 2018 09:59 AM|Bhavesh___|LINK
I got the solution. Pasting here is someone find it beneficial.
This was my code to create local string from chunk:
char * pStart = (char *)pChunk->FromMemory.pBuffer;
std::string sChunk = (char*)pStart;
The sChunk actually points to whole text pointed by pStart and it does not end at pChunk->FromMemory.BufferLength. My assumption was that it will truncate at pChunk->FromMemory.BufferLength.
So use this instead and it works:
std::string sChunk(pStart, pChunk->FromMemory.BufferLength);