Use overloaded method response.redirect("path",false) to avoid above mentioned error.
Cause of this error: response.redirect internally uses response.end. However, when you call response.redirect, it also shifts the execution to Applicaton_endRequest event and this does not allow the code following the response.end to be executed. Therefore, it reaises exception.
When you specify response.redirect("path", false) you explicity tell the run time to execute the code following the response.end menthod.
This work around has worked for me while using response.redirect in a user defined class which modifies the XML document.
For more info refer this page: