天天看点

CheckValidateCode

   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";

        }

    }