qq管家拦截域名检测,qq浏览器域名检测,qq域名检测源码

`

    public void ProcessRequest(HttpContext context)
    {
        //正式用
        userIP = GetWebClientIp(context);
        string urlCheck = string.Empty;
        context.Response.ContentType = "text/plain";
        string result = string.Empty;
        if (!string.IsNullOrEmpty(context.Request["url"]) && !string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
        {
            string userKey = context.Request["key"]; //key ,md5值

            if (userKey.Trim() == wxCheckApiKey)
            {
                result = "{\"State\":false,\"Code\",\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"参数错误,进qq群交流:41977413!\"}";
            }
            else
            {
                ServiceApiClient SpVoiceObj2 = null;
                //  ServiceApiClient SpVoiceObj = null;
                try
                {
                    //需要检测的网址
                    urlCheck = context.Request["url"]; //检测的值
                    bool isTrue = urlCheck.StartsWith("http");
                    if (!isTrue) { urlCheck = "http://" + urlCheck; }
                    urlCheck = System.Web.HttpUtility.UrlEncode(urlCheck);

                    string json2 = "{\"Mode\":\"AuthQQKey\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + userKey + "\'}\"}";

                    SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi");
                    SpVoiceObj2.Open();
                    result = SpVoiceObj2.Api(json2);
                    SpVoiceObj2.Close();
                    ////JsonObject.Results aup = JsonConvert.DeserializeObject<JsonObject.Results>(result);

                    ////if (aup.State == true)
                    ////{
                    ////    string json = "{\"Mode\":\"WXCheckUrl\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + userKey + "\'}\"}";
                    ////    SpVoiceObj = new ServiceApiClient("NetTcpBinding_IServiceApi");
                    ////    SpVoiceObj.Open();
                    ////    result = SpVoiceObj.Api(json);
                    ////    SpVoiceObj.Close();

                    ////}

                    if (!string.IsNullOrEmpty(context.Request.QueryString["callback"]))
                    {
                        string callBack = context.Request.QueryString["callback"].ToString(); //回调
                        result = callBack + "(" + result + ")";
                    }
                }
                catch (System.ServiceModel.CommunicationException)
                {
                    //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                    if (SpVoiceObj2 != null) SpVoiceObj2.Abort();
                }
                catch (TimeoutException)
                {
                    // if (SpVoiceObj != null) SpVoiceObj.Abort();
                    if (SpVoiceObj2 != null) SpVoiceObj2.Abort();
                }
                catch (Exception ex)
                {
                    //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                    if (SpVoiceObj2 != null) SpVoiceObj2.Abort();
                    result = "{\"State\":false,\"Code\",\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                    LogTools.WriteLine(userIP + ":" + userKey + ":" + ex.Message);
                }


            }
        }
        else
        {
            result = "{\"State\":false,\"Code\",\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"参数错误,进qq群交流:41977413!\"}";

        }

        context.Response.Write(result);
        context.Response.End();

    }

`


标签:qq管家拦截域名检测 qq浏览器域名检测 qq域名检测源码