Example #1
0
    public static void GetBeiAnResult(string sName,string sType,string sValue) 
    {
        //Init(@"C:\c#codes\BeiAnWeb\Bin\runtime.dat");
        BeiAnTools.ClassBeiAn CBA = new BeiAnTools.ClassBeiAn(sName,System.Configuration.ConfigurationManager.AppSettings["RuntimePath"]);//初始化备案接口
        CBA.sID = DateTime.Now.ToFileTime().ToString();//接口ID,需要赋予一个与其它接口不重复的值,用来区别下载的验证码文件

            ReGetChapcha://错误后返回这里重新查询
        //Response.Write("获取验证码...");
        string sChapcha = CBA.GetChapcha(System.Configuration.ConfigurationManager.AppSettings["ChapchaPath"]);//首先获取验证码

        if (sChapcha == "")//验证码为空
        {
            HttpContext.Current.Response.Write("可能网络错误,验证码识别为空");
            HttpContext.Current.Response.End();
            return;
        }

        CBA.sCheckType = sType;//设置查询类型 0=域名模式,1=备案号模式
        //CBA.sCheckType = "1";
        CBA.GetBeinAnInfo(sValue);//开始查询
        if (CBA.BeErr)//获取后报错,重试
        {
            goto ReGetChapcha;
        }
        else//结果正常,输出前最好对结果进行HTML过滤操作
        {

            HttpContext.Current.Response.Write(RemoveHtml(CBA.sBeiAn, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sDomain, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sICPNum, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sOwnerName, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sType, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sSiteName, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sSiteUrl, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sAddTime, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sBeiAnID, false));
            HttpContext.Current.Response.End();
        }
        
    }
Example #2
0
    public static void GetBeiAnResult(string sName, string sType, string sValue)
    {
        //Init(@"C:\c#codes\BeiAnWeb\Bin\runtime.dat");
        BeiAnTools.ClassBeiAn CBA = new BeiAnTools.ClassBeiAn(sName, System.Configuration.ConfigurationManager.AppSettings["RuntimePath"]); //初始化备案接口
        CBA.sID = DateTime.Now.ToFileTime().ToString();                                                                                     //接口ID,需要赋予一个与其它接口不重复的值,用来区别下载的验证码文件

ReGetChapcha:                                                                                                                               //错误后返回这里重新查询
        //Response.Write("获取验证码...");
        string sChapcha = CBA.GetChapcha(System.Configuration.ConfigurationManager.AppSettings["ChapchaPath"]);                             //首先获取验证码

        if (sChapcha == "")                                                                                                                 //验证码为空
        {
            HttpContext.Current.Response.Write("可能网络错误,验证码识别为空");
            HttpContext.Current.Response.End();
            return;
        }

        CBA.sCheckType = sType;    //设置查询类型 0=域名模式,1=备案号模式
        //CBA.sCheckType = "1";
        CBA.GetBeinAnInfo(sValue); //开始查询
        if (CBA.BeErr)             //获取后报错,重试
        {
            goto ReGetChapcha;
        }
        else//结果正常,输出前最好对结果进行HTML过滤操作
        {
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sBeiAn, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sDomain, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sICPNum, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sOwnerName, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sType, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sSiteName, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sSiteUrl, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sAddTime, false));
            HttpContext.Current.Response.Write(RemoveHtml(CBA.sBeiAnID, false));
            HttpContext.Current.Response.End();
        }
    }