求详解这串代码怎么实现登入和验证码以及大小写区分的

求详解这串代码如何实现登入和验证码以及大小写区分的
public partial class LoadingControl : System.Web.UI.UserControl    //响应网页的Load(装载)事件

{
    DBClass dbObj = new DBClass();
    UserInfoClass uiObj = new UserInfoClass(); 

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            lbValid.Text = new randomCode().RandomNum(4);//产生验证码
             if (Session["UID"] != null)
            {

                tabLoad.Visible = true;
                 tabLoading.Visible =false ;
            }        
        }
       
    }

    protected void btnLoad_Click(object sender, EventArgs e)
    {
        Session["UID"] = null ;
        Session["Username"] = null ;
        if (txtName.Text.Trim() == "" || txtPassword.Text.Trim () == "")
        {


            Response.Write("<script>alert('登录名和密码不能为空!');location='javascript:history.go(-1)';</script>");
        }
        else
        { 
            if (txtValid.Text.Trim() == lbValid.Text.Trim())
            {

                int P_Int_IsExists = uiObj.UserExists(txtName.Text.Trim(), txtPassword.Text.Trim());
                if (P_Int_IsExists == 100)
                {
                    DataSet ds = uiObj.ReturnUIDs(txtName.Text.Trim(), txtPassword.Text.Trim(), "UserInfo");
                    
                    Session["UID"] = Convert.ToInt32(ds.Tables["UserInfo"].Rows[0][0].ToString());
                    Session["Username"] = ds.Tables["UserInfo"].Rows[0][1].ToString();
                    Response.Redirect("index.aspx");
                }
                else
                {
                    //Page.RegisterStartupScript("0", "<script>alert('您的登录有误,请核对后再重新登录!');location='javascript:history.go(-1)';</script>");
                    Response.Write("<script>alert('您的登录有误,请核对后再重新登录!');location='javascript:history.go(-1)';</script>");

                }
            }
            else
            {
                Response.Write("<script>alert('请正确输入验证码!');location='javascript:history.go(-1)';</script>");            
            }
           
        
        
        }
    }
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        Response.Redirect("Register.aspx");
    }