-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Hi, How can i find if sessions/cookies expired ?
I used below code to create httpClient
var cookies = new CookieContainer();
var handler = new HttpClientHandler();
handler.CookieContainer = cookies;
handler.CookieContainer = cookies;
client = new HttpClient(handler);
and below Code to validate if Cookie is expired or not :
IEnumerable<Cookie> responseCookies = cookies.GetCookies(client.BaseAddress).Cast<Cookie>();
foreach (Cookie cookie in responseCookies)
{
if (cookie.Name == "CookieName" )
{
return !cookie.Expired;
}
}
return false;
would you please help me if I want to use your simple code !!!
//useage 1: same Host use same HttpClient
PerHostHttpClientFactory perHostHttpClientFactory = new PerHostHttpClientFactory(TimeSpan.FromSeconds(10));
HttpClient client = perHostHttpClientFactory.GetHttpClient("http://www.baidu.com");
Metadata
Metadata
Assignees
Labels
No labels