Glimpse/Glimpse — pull request #129 by dpen2000 (2011-11-06 22:55:14+00:00)
Title: Duplicating Html When Using Web Forms

When using web forms, turning on glimpse is resulting in everything before and including the form element beginning being duplicated so title element, any html before form element and crucially, viewstate. It seems web forms, at least the Microsoft version of it, calls any response filter's Write method twice: once with the html up to and including html rendered by beginning of and once with all the html after this. The current implementation of GlimpseResponseFilter sends to output any input that does not include "

" AND saves it to a StringBuilder. When the write method is called again, it outputs the whole of the html stored in the StringBuilder resulting in duplicated html. If a user clicks a button on a page where viewstate has been duplicated a "The state information is invalid for this page and might be corrupted" error is generated.

This commit includes a test that invokes the filter's Write like web forms does and a fix for this issue.