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