0
我的引擎是Aspx。如何在我的查看页面中使用html解码?
我目前在我的表中编辑我的一列(问题答案)时有问题,因为它里面有html标签。有没有一种方法可以解码值域中的特定行/列?
<form id="updateFreqQuestionsUser" action="<%=Url.Action("SaveFreqQuestionsUser","Prod")%>" method="post">
<table>
<tr>
<td colspan="3" class="tableHeader">Freq Questions User Details <input type ="hidden" value="<%=freqQuestionsUser.freqQuestionsUserId%>" name="freqQuestionsUserId"/> </td>
</tr>
<tr>
<td colspan="2" class="label">Question Description:</td>
<td class="content">
<input type="text" maxlength="2000" name="QuestionDescription" value="<%=freqQuestionsUser.questionDescription%>" />
</td>
</tr>
<tr>
<td colspan="2" class="label">QuestionAnswer:</td>
<td class="content">
<input type="text" maxlength="2000" name="QuestionAnswer" value="<%=freqQuestionsUser.questionAnswer%>" />
</td>
</tr>
<tr>
<td colspan="3" class="tableFooter">
<br />
<a id="freqQuestionsUserUpdateButton" href="#" class="regularButton">Save</a>
<a href="javascript:history.back()" class="regularButton">Cancel</a>
</td>
</tr>
</table>
我试过了,当我试图编辑。我把名字
yusuf
电话
814-274-6484然后它给了我这个错误 从客户端检测到有潜在危险的Request.Form值(QuestionAnswer =“... ics Phone:
814-274-6484 < b ...“) – Yusuf 2012-07-30 14:18:20
这完全正常。 ASP.NET正在验证可能的XSS攻击。如果您需要将此字段提交回服务器,则必须将其编码为不具有任何HTML标记的东西。例如,您可以使用base64编码,但如果您希望能够支持所有浏览器,则需要使用jquery插件。 – Icarus 2012-07-30 14:28:25
好的。我正在连接回服务器。我将谷歌base64编码 – Yusuf 2012-07-30 14:42:38