怎么把下面这段代码的验证码屏蔽或者改成固定的如1111,谢谢啦

前端:<%@ Page Language="C#" MasterPageFile="~/zt.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits=" Login_aa" Title="会员登入" %>


/asp:Content























后端:using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;

public partial class Login_aa : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
    string email = Server.HtmlEncode(TextBox3.Text);
    string pwd = Server.HtmlEncode(TextBox4.Text);
    Model.user mod = new Model.user();
    mod.email = email;
    mod.pwd = pwd;

    BLL.user bll = new BLL.user();
    SqlDataReader  dr = bll.login(mod);

    if (CheckBox1.Checked)
    {
        SqlDataReader dr1 = bll.lo(mod);
        if (dr1.Read())
        {
            Session["_username"] = dr1["_username"].ToString();
            Session["_userid"]=dr1["_userid"].ToString();

            dr1.Close();
        }
        dr1.Close();
    }
    else
    {
        Session["_username"] = "";
    }

    if (Session["CheckCode"] != null)
    {

        if (TextBox1.Text.ToLower() == Session["CheckCode"].ToString().ToLower())
        {

            if (dr.Read())
            {
                Response.Redirect("ACIndex.aspx");



                Model.user mol = new Model.user();
                mol.userid = Convert.ToInt32(Session["_userid"]);

                BLL.user bllu = new BLL.user();
                int r = bllu.loginLastTime(mol);
                SqlDataReader dr2 = bll.lo(mod);
                if (dr2.Read())
                {
                    Session["_username"] = dr2["_username"].ToString();
                    Session["_userid"] = dr2["_userid"].ToString();
                    dr2.Close();
                }
                dr2.Close();
            }

            else
            {
                Common.MessageAlert.Alert(Page, "账号或密码错误,登入失败!");
            }

        }
        else
        {
            Common.MessageAlert.Alert(Page, "验证码错误!");

        }



    }

}
}

Email /asp:TextBox
密码

/asp:TextBox
验证码

/asp:TextBox验证码

记住用户名

1个回答

if (TextBox1.Text.ToLower() == Session["CheckCode"].ToString().ToLower()) 这个应该就是验证码的判断语句,把这个if和对应的else去掉就可以不要验证码了。或者把Session["CheckCode"].ToString().ToLower()改成"1111"就是你要的固定值

zzt611680
zzt611680 搞好了谢谢啦
8 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐