合肥滨湖房产中介电话:asp.net 防止用户多次提交的解决办法

来源:百度文库 编辑:偶看新闻 时间:2024/06/12 07:16:17

//产生随机验证码
        public static String getYangZhengMa()
        {
            String tempRsult = "";
            Random myRandom = new Random();
            for (int i = 0; i < 2; i++)
            {
                int myGetInt = myRandom.Next(65, 90);
                tempRsult += ((char)myGetInt).ToString();
            }
            return tempRsult;
        }

 

 

 if (!Page.IsPostBack)
 {

       this.hid_YanZhengMa.Value = System.mySQLConnection.AllText.getYangZhengMa();
       Session["YanZhengMa"] = this.hid_YanZhengMa.Value;

}

 

 protected void submit_jiaoFei_ServerClick(object sender, EventArgs e)
 {

         if (hid_YanZhengMa.Value.Trim() != ((String)Session["YanZhengMa"]))
        {
            MessageBox.alert(Page, "不能重复提交");
            return;
        }

}