CheckValidateCode

来源:互联网 发布:个性手机qq主题软件 编辑:程序博客网 时间:2024/05/29 16:11

 

   function CheckValidateCode()
   {
    obj = document.all["tbValidCode"].value;
    response = CompanyReg.GetValidateCode(obj);
    if(response.value != "sucess")
    {
     //alert(response.value);
     //document.all["tbValidCode"].focus();
     SetSpan("spValiateCode","验证码错误");
     return false;
    }
    SetSpan("spValiateCode","");
    return true;
   }

Ajax.Utility.RegisterTypeForAjax(typeof(PageClass));

[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)]
    public string GetValidateCode(string strValue)
    {
        string result = "";
        try
        {
            if (System.Web.HttpContext.Current.Session["CheckCode"].ToString() == strValue.Trim().ToUpper())
            {
                result = "sucess";
            }
            else
            {
                result = "fail";
            }
            return result;
        }
        catch
        {
            return "fail";
        }
    }

原创粉丝点击