<p>When I call <code>Response.Redirect(someUrl)</code> I get the following HttpException:</p>

<blockquote>
  <p>Cannot redirect after HTTP headers have been sent.</p>
</blockquote>

<p>Why do I get this? And how can I fix this issue?</p>

A Redirect can only happen if the first line in an HTTP message is "
```
HTTP/1.x 3xx Redirect Reason
```
".
If you already called
```
Response.Write()
```
or set some headers, it'll be too late for a redirect. You can try calling
```
Response.Headers.Clear()
```
before the Redirect to see if that helps.