public PromptMsg ChangeUserMessage(string pKeyName, string pKeyValue, string pToken) { try { string str = "keyName=" + pKeyName + "&keyValue=" + pKeyValue; string data = HttpRequestSsoVerifyPost("common!updateProfile.action", str, pToken); return(CWHelper.Deserialize <PromptMsg>(data)); } catch (Exception ex) { return(null); } }
//public static string SendHttpRequestGet(string requestMethod, string json, string pToken) //{ // //json格式请求数据 // string requestData = json; // if (!string.IsNullOrEmpty(json)) // json = "?" + json; // //拼接URL // string serviceUrl = string.Format("{0}{1}", PG_SERVER_URL, requestMethod + json); // HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(serviceUrl); // //utf-8编码 // byte[] buf = System.Text.Encoding.GetEncoding("UTF-8").GetBytes(requestData); // //POST请求 // myRequest.Method = "POST"; // myRequest.ContentLength = buf.Length; // //指定为json否则会出错 // myRequest.Accept = "application/json"; // myRequest.ContentType = "application/json"; // //Content-type: application/json; charset=utf-8 // //myRequest.ContentType = "text/json"; // myRequest.MaximumAutomaticRedirections = 1; // myRequest.AllowAutoRedirect = true; // Stream newStream = myRequest.GetRequestStream(); // newStream.Write(buf, 0, buf.Length); // newStream.Close(); // //获得接口返回值,格式为: {"VerifyResult":"aksjdfkasdf"} // HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse(); // StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8); // string ReqResult = reader.ReadToEnd(); // reader.Close(); // myResponse.Close(); // return ReqResult; //} #region token验证 /// <summary> /// token验证 /// </summary> /// <returns></returns> public SsoVerify SsoVerify(string pToken) { string data = HttpRequestSsoVerifyPost("common!ssoVerify.action", string.Empty, pToken); return(CWHelper.Deserialize <SsoVerify>(data)); }