首页 > Web开发 > 详细

GeckoWebBrowser设置cookie

时间:2018-03-14 14:12:40      阅读:1155      评论:0      收藏:0      [点我收藏+]
var uri = new Uri("http://www.aa.com");
            //often cookies are stored on domain level, so ".google.com", not "www.google.com" (leading dot is important)
            string host = uri.Host.Replace("www", "");
            CookieManager.Add(host, "/", "cookieName", "cookieValue", false, false, false, ConvertDateTimeInt(DateTime.Now.AddYears(3)));
        /// <summary>  
        /// DateTime时间格式转换为Unix时间戳格式  
        /// </summary>  
        /// <param name="time"> DateTime时间格式</param>  
        /// <returns>Unix时间戳格式</returns>  
        public static int ConvertDateTimeInt(System.DateTime time)
        {
            System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
            return (int)(time - startTime).TotalSeconds;
        }

 

GeckoWebBrowser设置cookie

原文:https://www.cnblogs.com/IWings/p/8566645.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!