ASP.NET 3.5, googlebot, 301 Redirect "Cannot redirect after HTTP headers have been sent"
<p>I have set up a dynamic 301 redirect routine within a custom HttpModule. The code accepts the incoming url, parses the querystring, and using a config and app specific logic, redirects to a new SEO friendly url using the following code:</p>

<pre><code>if (HttpContext.Current.Response.IsRequestBeingRedirected)
    return;

if (!HttpContext.Current.Response.IsClientConnected)
{
    response.End();
    return;
}

response.Redirect(newLocation, false);
response.Status = "301 Moved Permanently";
response.StatusCode = 301;
</code></pre>

<p>This works fine and dandy if you enter a legacy url directly in a web browser. However, my event log is showing a bunch of "Cannot redirect after HTTP headers have been sent" HttpExceptions when the same url is accessed by the googlebot (66.249.71.11). </p>

<p>I'm at a loss as to what the issue is and how to resolve it.</p>
