Get/post request the cookie returned is not all of the key values we need, we just need to extract what we need to regroup.
A cookie returned as a GET request
I need to extract the Uin,skey and other key value pairs.
The following functions can do what we need:
Using System.Text.RegularExpressions;
public string Getcookiebyname (list<string> keylist, string cookie) { string str = ""; foreach (string key in Keylist) { regex regex = new Regex (string. Format ("{0}=[^;] + ", key)); Match match = regex. Match (cookie); if (match. Success) { String value = ""; if (str. Length = = 0) value = match. Value; else value = ";" + match. Value; str = str + value; } } return str; }
Call Method:
list<string> keylist = new List<string> {"Pt2gguin", "UIn", "Skey", "Superuin", "Superkey", "Supertoken", "RK "," Ptcz "}; Cookie = getcookiebyname (keylist, cookie);
Re-grouping the key-value pairs in the Get/post request return cookie