注册 登录
编程论坛 ASP.NET技术论坛

判断验证码出错!

xakir 发布于 2011-04-10 22:00, 751 次点击
我新学 的想写 登陆界面 网上找到了 图片验证码的代码那个已经正常条用但是判断验证码出错 你们看看代码吧
session 和 文本框的值 都一样但是就不提示验证码正确那个提示 代码贴着了你们看看吧
程序代码:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
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.Xml.Linq;

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

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string xinxi = Session["ValidateCode"].ToString();
       string xinxi1=TextBox3.Text;
       MsgBox(xinxi1);
        if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "")
        {
            MsgBox("Uqur lar ni kuruk koy mang!");

        }
        else
        {


            if (xinxi == xinxi1)
           {
               MsgBox("验证吗正确!");
           }
           else
           {
            
           }

        }
        MsgBox(xinxi);

    }
    public void MsgBox(string strMsg)
    {
        string StrScript;
        StrScript = ("<script language=javascript>");
        StrScript += ("alert('" + strMsg + "');");
      
        StrScript += ("</script>");
        System.Web.HttpContext.Current.Response.Write(StrScript);
    }
   

}

2 回复
#2
金海11082011-04-11 10:27
只有本站会员才能查看附件,请 登录

里面是我的,你照着看看吧!!
#3
panyanpan2011-04-15 14:46
楼主  你在 if (xinxi == xinxi1)   这句  
打个断点 调试 看看   
xinxi 的值  和 xinxi1 的值 到底 是多少     或者 看看  程序 有没进到  if (xinxi == xinxi1) 这句
1