可以的,首先你的<form id="form1" runat="server">,你的按钮<asp:Button ID="Button_commit" runat="server" Text="登录" OnClick="Button_commit_Click" />就在Button_commit_Click事件中验证,例如protected void Button_commit_Click(object sender, EventArgs e){String code = (string)(Session["Code"]);if (this.TextBox_code.Text.Trim() == code.ToLower()) //TextBox_code是我的验证码的输入框{Response.Write("<script>alert('验证码正确');</script>");}else{Response.Write("<script>alert('验证码错误');</script>");}当然,你可以在登录的页面放个<asp:Label ID="Label1" runat="server" ForeColor="Red" Width="224px"></asp:Label>正确错误就在这个label中显示