Value Response Header Get Set Cookie In C#
client.MaxResponseContentBufferSize = Int32.MaxValue;
HttpResponseMessage response = await client.GetAsync(new Uri("http://www.google.com"));
string j = (response.Headers.ToString());
IList<string> valu = j.Split(' ').Reverse().ToList<string>();
for (int i = 0; i < j.Length; i++)
{
if (valu[i].StartsWith("JSESSIONID"))//if Set-Cookie
{
var s = valu[i];
char[] delimiters = new[] { ',', ';', ' ' }; // List of your delimiters
var splitte = s.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
s = splitte[0].Replace("JSESSIONID=", "");
}
}
No comments:
Post a Comment