×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: C#
Posted by: Igor Berezhnoy
Added: May 8, 2020 12:17 PM
Views: 4334
Tags: no tags
  1. req.CookieContainer = new CookieContainer();
  2.  
  3.             // copy cookies
  4.             foreach (var cookie in cookieSet)
  5.             {
  6.                 try
  7.                 {
  8.                     req.CookieContainer.Add(new Cookie(cookie["name"].ToString(),
  9.                         HttpUtility.UrlEncode(cookie["value"].ToString()),
  10.                         cookie["path"].ToString(),
  11.                         cookie["domain"].ToString()));
  12.                 }
  13.                 catch
  14.                 {
  15.                     // ignored
  16.                 }
  17.             }