Jak Response.Write na IIS7.5?

Próbuję napisać odpowiedź do klienta:

response.StatusCode = (int)HttpStatusCode.BadRequest;
response.ClearContent();
response.Write(String.Format(
      "<!doctype html>"+CRLF+
      "<html>" + CRLF +
      "<head><title>{0}</title></head>" + CRLF +
      "<body><h1>{0}</h1>"+CRLF+
      "{1}"+CRLF+
      "</body>" + CRLF +
      "</html>", 
      response.Status, "The grob must be in the frobber."));
response.Flush();
response.End();

Kod działa dobrze podczas pracy na localhost (Visual Studio (2010 (Windows 7 (Professional (64-bit))))) rozwój serwera internetowego Cassini:

HTTP/1.1 400 Bad Request
Server: ASP.NET Development Server/10.0.0.0
Date: Tue, 17 Jul 2012 15:56:42 GMT
X-AspNet-Version: 4.0.30319
Cache-Control: private
Content-Type: text/html
Connection: Close

<!doctype html>
<html>
<head><title>400 Bad Request</title></head>
<body><h1>400 Bad Request</h1>
The grob must be in the frobber.
</body>
</html>

Ale kiedy wdrażam stronę internetową do systemu Windows Server 2008 R2 z uruchomionym IIS7.5, ten sam kod nie działa:

HTTP/1.1 400 Bad Request
Cache-Control: private
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 17 Jul 2012 15:57:44 GMT
Content-Length: 11

Bad Request

Jak mam wykonaćResponse.Write z IIS?

questionAnswers(3)

yourAnswerToTheQuestion