0

我一直在从事一个asp.net必须在 IIS 7.5 上以集成模式工作的项目。

当我使用 时Response.write("sometext"),用废旧标签IIS包裹我的文本。HTML

看看这段代码:

protected void Application_BeginRequest(object sender, EventArgs e)
{
        Response.Clear();
        Response.ClearContent();
        StringBuilder sb = new StringBuilder();
        sb.Append("<html>");
        sb.Append("<head>");
        sb.Append("</head>");
        sb.AppendFormat("<body>");
        sb.AppendFormat("some text");
        sb.Append("</body>");
        sb.Append("</html>");
        Response.Write(sb.ToString());
        Response.End();

}

我希望从服务器收到这个:

<html>
<head>
</head>
<body>
sometext
</body>
</html>

但服务器给了我这个:

 <html> 
 <head>
 </head>
 <body>
 <pre>
      <html><head></head><body>sometext</body></html>
 </pre>
 </body>
 </html>

有什么问题??

应用程序在VS web developer serverIIS(在经典模式下)运行良好。

4

1 回答 1

0

两天后,如果使用 Response.Flush(); 命令 IIS 无法包装响应

于 2015-11-07T08:07:36.973 回答