有这样一段程序:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>标题页</title>
</head>
<body>
<form Name="InputForm">
<div align="center"><center><p>
<script language="JavaScript">
var FirstForm;
function StartSearch()
{
//使用隐藏控件保存用户输入的查询参数
document.forms[FirstForm+document.InputForm.SearchSelect.
selectedIndex].elements[0].value=document.InputForm.SearchWords.value;
//提交查询参数到指定网站
document.forms[FirstForm+document.InputForm.SearchSelect.selectedIndex].submit();
}
</script>
<span style="font-size: 9pt">查找内容:</span>
<input name="SearchWords" type="text" size="21" style=" margin-left: 1px"><br>
<span style="font-size: 9pt">搜索引擎:</span>
<select Name="SearchSelect" size="1" >
<option selected>英文Yahoo</option>
<option value="Google搜索">中文Google</option>
<option value="百度搜索">百度中文搜索</option>
</select><br>
<input type="button" value=" 开始查找 " onClick="StartSearch()"> 
<script language="JavaScript">
FirstForm=document.forms.length
</script></p>
</center></div>
</form>
<form action="http://search.yahoo.com/bin/search" method="get">
<input type="hidden" name="p" value>
</form>
<form action="http://www.google.com/search">
<input type="hidden" name="q" value>
</form>
<form action="http://www.baidu.com/s">
<input type="hidden" name="wd" value>
</form>
</body>
</html>
原来运行的很好,当在vs2005中新增htm页面后,把这段程序拷进去,运行时中文百度搜索时结果出现乱码;
当新增aspx页面后,把这段程序拷进去,运行没有反应,提示网页上有错误。
我想是否版本问题,原来的程序版本低了,怎么转换呢?

解决方案 »

  1.   

    应该是由于web.config没有设置正确编码。
    在web.config中增加:
    <globalization fileEncoding="gb2312" requestEncoding="gb2312" responseEncoding="gb2312" culture="zh-CN" uiCulture="zh-CN"/>另外aspx文件必须放到iis虚拟目录中才能执行。请确认你的测试环境是否正常,在我的机器上两种方式都测试通过。
      

  2.   

    放在web.config的那个配置节,就是什么地方?
    另外,我在iis建的是网站,在默认网站下。