HTTP标头问题

时间:2011-07-05 08:49:18

标签: asp-classic

我收到以下错误:

Response object error 'ASP 0156 : 80004005'

Header Error

/includes/page_language.asp, line 3

The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content. 

但是,页面的第一行是doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

下一行是:

<!-- #include file = "includes/page_language.asp" -->

page_language.asp文件中的前4行是:

<%
response.codePage = 65001
response.charset = "utf-8"
%>

所以它不喜欢 response.charset =“utf-8” - 但在这些行之前没有HTML导致问题......

此错误仅在您第一次加载页面时发生 - 当发生这种情况时按下刷新并且页面加载正常。该网站工作正常,但我们昨天注意到了这一点。

更新: 我现在已将index.asp更改为:

<%
response.codePage = 65001
response.charset = "utf-8"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

但我仍然在response.charset线上收到错误.... 我很难过 - 任何建议都会非常感激!

2 个答案:

答案 0 :(得分:0)

尝试使用firebug并测试response.charset。看起来就像是 不是HTTP Content-Type charset而是<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

答案 1 :(得分:0)

最后通过删除response.charset =“utf-8”并添加

来修复
<meta http-equiv="content-type" content="text/html;charset=utf-8">