Ejemplo n.º 1
0
        //
        public string LogoffPage(System.Web.HttpContext context, string resptype)
        {
            //MessageBox.Show("logoff");
            string      respxml  = string.Empty;
            HttpRequest request  = context.Request;
            Hashtable   RespData = new Hashtable();

            RespData["success"] = true;
            RespData["method"]  = request.Form.Get("method").ToString();
            if (HttpContext.Current.Request.Cookies["AdminInfo"] != null)
            {
                string sessionID = context.Request.Cookies["AdminInfo"]["sessionID"].ToString();
                string username  = context.Request.Cookies["AdminInfo"]["userName"].ToString();
                RespData["username"]    = username;
                RespData["userserver"]  = WebFrameWork.GetServerCookieValueByNode("userserver");
                RespData["moneyserver"] = WebFrameWork.GetServerCookieValueByNode("moneyserver");
                WebFrameWork.ReleaseCache(sessionID);
            }
            else
            {
                RespData["success"] = false;
            }

            WebFrameWork.ReleaseVerifyInfo();
            WebFrameWork.ReleaseCookieUserInfo();
            // context.Response.Expires = -1;


            respxml = AssemblerDictionary.AssemblerPlugins[resptype].GenerateXml(context, (Object)RespData);
            return(respxml);
        }
Ejemplo n.º 2
0
        public string XmlRpcResponse(HttpContext context, string seruri, string resptype, System.Collections.Hashtable reqParams)
        {
            ArrayList   arrayParm = new ArrayList();
            HttpRequest request   = context.Request;

            arrayParm.Add(reqParams);
            XmlRpcResponse serResp  = null;
            Hashtable      RespData = new Hashtable();
            string         method   = request.Form.Get("method").ToString();

            string respxml = string.Empty;

            //MessageBox.Show(seruri);
            //MessageBox.Show(method);
            //foreach (DictionaryEntry de in reqParams)
            //{
            //    MessageBox.Show(de.Value + "  " + de.Key);
            //}

            try
            {
                XmlRpcRequest serReq = new XmlRpcRequest(method, arrayParm);
                serResp = serReq.Send(seruri);//, _REQUEST_TIMEOUT);
            }
            catch (Exception ex)
            {
                RespData["success"] = false;
                RespData["method"]  = method;
                RespData["message"] = ex.Message.ToString();
                RespData["seruri"]  = seruri;
            }
            if (serResp.IsFault)
            {
                RespData["success"] = false;
                RespData["method"]  = method;
                RespData["message"] = "Failed to Connet server: " + seruri.ToString();
                RespData["seruri"]  = seruri;
            }
            else if (method.Equals("get_user_by_name"))
            {
                //MessageBox.Show(request.Form.Get("verifynumber").ToUpper() + "           " + request.Cookies["CheckCode"].Value.ToString());
                if (String.IsNullOrEmpty(request.Form.Get("verifynumber").ToString()))
                {
                    RespData["success"]    = false;
                    RespData["method"]     = method;
                    RespData["message"]    = "Verify number is empty!";
                    RespData["seruri"]     = seruri;
                    RespData["error_type"] = "verify_error";
                }
                else
                {
                    if (request.Cookies["CheckCode"] == null)
                    {
                        RespData["success"]    = false;
                        RespData["method"]     = method;
                        RespData["message"]    = "Your webbrowser must forbid the cookies!";
                        RespData["seruri"]     = seruri;
                        RespData["error_type"] = "verify_error";
                    }
                    else if (request.Form.Get("verifynumber").ToUpper() != request.Cookies["CheckCode"].Value.ToString())
                    {
                        RespData["success"]    = false;
                        RespData["method"]     = method;
                        RespData["message"]    = "Verify number is error!";
                        RespData["seruri"]     = seruri;
                        RespData["error_type"] = "verify_error";
                    }
                    else
                    {
                        RespData = (Hashtable)serResp.Value;
                        if (RespData.ContainsKey("error_type"))
                        {
                            RespData["success"] = false;
                            RespData["message"] = RespData["error_desc"];
                        }
                        else
                        {
                            RespData["success"]     = true;
                            RespData["username"]    = request.Form.Get("avatar_name").ToString();
                            RespData["userID"]      = (string)RespData["uuid"] + "@" + request.Form.Get("seruri").ToString();//"23cc97ee-6fa1-46cc-83bd-80fdafc1255a" + "@" + "127.0.0.1";//
                            RespData["moneyserver"] = request.Form.Get("seruris").ToString();


                            //WebFrameWork.ReleaseSession();
                            // WebFrameWork.ReleaseCookieUserInfo();

                            // WebFrameWork.RegisterCookieUserInfo(request, (string)RespData["uuid"]);
                        }
                        RespData["method"] = method;
                        RespData["seruri"] = seruri;
                    }
                }
            }
            else
            {
                RespData = (Hashtable)serResp.Value;
                if (method.Equals("WebLogin"))
                {
                    WebFrameWork.ReleaseCookieUserInfo();
                    WebFrameWork.RegisterCookieUserInfo(request, reqParams["sessionID"].ToString());
                    RespData["username"]    = request.Form.Get("userName").ToString();
                    RespData["userserver"]  = request.Form.Get("userID").ToString().Split('@')[1].ToString();
                    RespData["moneyserver"] = request.Form.Get("seruris").ToString();
                    WebFrameWork.RegisterCookieServerInfo(request.Form.Get("userID").ToString().Split('@')[1].ToString(), request.Form.Get("seruris").ToString());
                }

                RespData["success"] = true;
                RespData["method"]  = method;
                RespData["seruri"]  = seruri;
            }
            // MessageBox.Show(AssemblerDictionary.AssemblerPlugins[resptype].AssemblerType);
            respxml = AssemblerDictionary.AssemblerPlugins[resptype].GenerateXml(context, RespData);

            return(respxml);
            // return RespData;
            // AssemblerDictionary.AssemblerPlugins[resptype].GenerateXml(
        }