我是从头开始开发新的 asp.net 网络表单应用程序的新手。
问题:在本地和测试服务器上一切正常。在客户服务器上部署应用程序有一些奇怪的行为。
仅使用 Internet Explorer,并且仅在某些情况下,浏览器中的响应会被错误地呈现。我看到 HTML 重复出现,JavaScript 直接呈现在屏幕上,在错误的地方与 HTML 混合在一起。
一切似乎都是随机发生的。
为 Damon 编辑:我需要 10 个声望来放置图像,这就是糟糕的 html 有时在 ie 中呈现的方式:
//]]>
</script>
??c?cr??|?04?*?9|u? ?*B?T߮?+mDp??}:?-?؉Ч????H?????:?t??dH$??D" disabled="disabled" class="aspNetDisabled txtSolaLettura" disabled="disabled" style="display:none">
<option selected="selected" value=""></option>
<option value="M">M</option>
<option value="F">F</option>
</select><input name="ctl00$cpHolderBody$GHOSTIndice§STRINGA§SD" type="text" maxlength="1" id="GHOSTIndice§STRINGA§SD" class="txtSolaLettura" readonly="readonly" /></td><td>Cognome Dichiarante</td><td class="STRINGA"><input type="hidden" name="ctl00$cpHolderBody$CTRLIndice§STRINGA§CD" id="CTRLIndice§STRINGA§CD" value="TextBox§Cognome Dichiarante§strtfrmtndfrmt§strtdcml0nddcml" /><input name="ctl00$cpHolderBody$JSONIndice§STRINGA§CD" type="text" maxlength="30" id="JSONIndice§STRINGA§CD" class="txtSolaLettura" readonly="readonly" /></td>
</tr><tr>
<0
TM??OG?[?
@K??a?6%\?
J????-?????
???^??y;hK?2cD?>?pK?O?tl00$cpHolderBody$CTRLIndice§STRINGA§ND"id="CTRLIndice§STRINGA§ND"value="TextBox§Nome Dichiarante§strtfrmtndfrmt§strtdcml0nddcml"/>Codice Dichiarazione Anagrafica
为 Paul 编辑:wcf 是休息,发送和接收的数据是 json
不知道这是否重要:
我认为这可能涉及服务器或客户端缓存......或服务器端缓冲......
任何想法将不胜感激。
最佳答案
我将对此进行尝试,并猜测这与未在 http header 中正确设置字符编码以及服务器在渲染时设置错误编码有关。
从此page :
You should always specify the encoding used for an HTML or XML page. If you don't, you risk that characters in your content are incorrectly interpreted. This is not just an issue of human readability, increasingly machines need to understand your data too. You should also check that you are not specifying different encodings in different places.
您可以使用 fiddler 进行检查并检查正在发送的 http header 。
我建议按照 here 的描述指定一个编码。在 MSDN 中。
从该页面:
<configuration>
<system.web>
<globalization
fileEncoding="utf-8"
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="en-US"
uiCulture="de-DE"
/>
</system.web>
</configuration>
关于javascript - Asp.Net Web 表单有时会在 Internet Explorer 中奇怪地混合 HTML 和 JavaScript 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22063362/