【发布时间】:2018-08-13 20:44:37
【问题描述】:
我需要修复 aspx 页面的 CSRF 缺陷。代码是这样的-
ASPX -
<asp:Content runat='server'>
<asp:Panel runat='server'>
<table>
<tr>
<td>Username</td>
<td><asp:TextBox runat="server" ID="Username" autocomplete="off"></asp:TextBox></td>
</tr>
<tr>
<td>Password</td>
<td><asp:TextBox runat="server" ID="Password" TextMode="Password" autocomplete="off"></asp:TextBox></td>
</tr>
<tr>
<asp:Button ID="Submit" runat="server" Text="Submit"
OnClick="SubmitButton_Click" CssClass="Resizable" />
</tr>
</table>
</asp:Panel>
</asp:Content>
ASPX.cs -
protected void SubmitButton_Click(object sender, EventArgs e)
{
//Code here
}
现在在顶部插入 时会引发错误“服务器块格式不正确”。那么我应该如何进行修复。
【问题讨论】:
标签: asp.net csrf antiforgerytoken