在文本框中添加此html后的设计问题
我的数据库中有一个文本,有一列,它包含如下值在文本框中添加此html后的设计问题,html,Html,我的数据库中有一个文本,有一列,它包含如下值 <br /><style><br /><!--<br /> 您正在将注释的开头添加到页面中,以便页面的其余部分被注释掉。在将无法控制的数据插入页面时,应该非常小心。一句开场白是相当天真的。假设一个黑客在你的数据库中创建了一个带有脚本标记的条目,其中包含一些恶意脚本 您需要对数据进行html编码 <%: db.myData %> // note the colon // is sho
<br /><style><br /><!--<br />
您正在将注释的开头添加到页面中,以便页面的其余部分被注释掉。在将无法控制的数据插入页面时,应该非常小心。一句开场白是相当天真的。假设一个黑客在你的数据库中创建了一个带有脚本标记的条目,其中包含一些恶意脚本
您需要对数据进行html编码
<%: db.myData %> // note the colon
// is short-hand for
<%= Server.HtmlEncode(db.myData) %>
//注意冒号
//是的缩写
<tr>
<td width="590" colspan="2">
<div id="divBio" runat="server" style="margin-bottom: 0px; overflow: auto;
width: 400px; height: 50px"><br /><style><br /><!--<br /></div>
<asp:TextBox ID="txtBio" Style="overflow: auto" onchange="fnUpdate();" runat="server" Height="50px" Width="400px" Wrap="true" TextMode="MultiLine"></asp:TextBox><br /><style><br /><!--<br /></td>
</tr>
<br /><style><br /><!--<br />
<%: db.myData %> // note the colon
// is short-hand for
<%= Server.HtmlEncode(db.myData) %>