1.HttpUtility.HtmlEncode 将危险的符号转换为它们的 HTML 表示形式
2. 注意C#语法中的分号。
说明
HttpUtility.HtmlEncode 将危险的符号转换为它们的 HTML 表示形式
另注意C#中分号的用法。
object sender指的是消息的发送者,
如Button_Click事件中的事件发送者即为Button,
但在使用时需对sender进行转换.
Eventargs e则是Eventargs类的一个实例,主要表示事件中的一些信息。
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” >
<head runat=”server”>
<title>无标题页</title>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<asp:TextBox ID=”UserName” runat=”server” />
<asp:Button ID=”Btn” OnClick=”Submitbtn_Click” runat=”server” Text=”Click Me!” />
<asp:label ID=”Message” runat=”server” /></div>
</form>
</body>
</html>