我試圖找出其中可以用來HtmlAttributeEncode上下文 - 「你好!」我用簡單的嘗試AntiXSS - HtmlAttributeEncode使用
警告腳本被設置爲控件屬性,所以我可以看到HtmlAttributeEncode的作用 - 但不能看到我可以使用HtmlAttributeEncode而不是HtmlEncode。
因此,舉例來說,我有
- a textbox for user input
//txtuserInput.Text = <script>alert(document.cookie);</script>
- an anchor control to show user input being set as one of its attribute value
In codebehind tried with -
myanchorTag.InnerText = txtuserInput.Text
or
myanchorTag.Id = txtuserInput.Text
但我不能看到這個腳本運行:-(
我已經嘗試過,對於TextBox.Text財產但是,我可以使用的HTMLEncode。
任何人都可以請導遊
謝謝
你使用的是什麼asp.net版本? – Aristos 2012-02-16 16:53:20
我正在使用.net 4.0 – iniki 2012-02-16 16:58:08