How to pass-through custom content of an HTTP 401 in Azure?
<p>I have an application which provides custom content on HTTP 401. The authorization filter which inherits from <code>AuthorizeAttribute</code> contains a method like this:</p>

<pre><code>protected override void HandleUnauthorizedRequest(
    AuthorizationContext filterContext)
{
    filterContext.HttpContext.Response.Clear();
    filterContext.HttpContext.Response.StatusCode =
        (int)HttpStatusCode.Unauthorized;
    filterContext.HttpContext.Response.Write("Custom content goes here.");
    filterContext.Result = new HttpUnauthorizedResult();
}
</code></pre>

<p>When running the application locally and hitting a protected resource, the custom content is displayed successfully.</p>

<p>Once deployed to Windows Azure, the application simply displays:</p>

<blockquote>
  <p>You do not have permission to view this directory or page.</p>
</blockquote>

<p>The header is still correct <code>HTTP/1.1 401 Unauthorized</code>, but the content I've set is gone.</p>

<p>How to prevent Azure from interfering with my application and pass-through the content from <code>Responde.Write</code> through HTTP down to the client?</p>