首页 新闻 赞助 找找看

timeStamp,这个是什么东西?怎样才能写到Cookie里去? Cookie.TimeStamp 属性?

0
悬赏园豆:10 [已解决问题] 解决于 2013-10-18 17:11

一网站,登录成功后,进入必须登录了才能访问的页面时要提交以下Cookie,

用Fiddle换取到的:

C# code?
1
Cookie: ASP.NET_SessionId=4lfgopz3bft2hwbfr20tve55; timeStamp=1



现在我是这样设置Cookie的:

// 解析Cookie

        /// </summary>
        /// <param name="response"></param>
        private void ParseCookie(HttpWebResponse response)
        {
            if (!IgnoreCookies)
            {
                string cookiesExpression = response.Headers["Set-Cookie"];
                if (!string.IsNullOrEmpty(cookiesExpression))
                {
                    Uri cookieUrl = new Uri(string.Format("{0}://{1}:{2}/",
                        response.ResponseUri.Scheme,
                        response.ResponseUri.Host,
                        response.ResponseUri.Port));
 
                    _cookieContainer.SetCookies(cookieUrl, cookiesExpression);
                }
            }
        }

 

但是这样设置最终的Cookie是这个样子的:
Cookie: ASP.NET_SessionId=4lfgopz3bft2hwbfr20tve55;

导致访问网页提提示302:
HTTP/1.1 302 Found
Date: Mon, 14 Oct 2013 14:35:28 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Location: 
Cache-Control: private
Content-Type: text/html; charset=GB18030
Content-Length: 117

<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href=''>here</a>.</h2>
</body></html>

【疑难】怎样才能把字符串:timeStamp=1,追加到最后呢?

参考:
Cookie.TimeStamp 属性 (System.Net)
http://msdn.microsoft.com/zh-cn/library/system.net.cookie.timestamp(VS.90).aspx

alone2013的主页 alone2013 | 初学一级 | 园豆:46
提问于:2013-10-14 23:15
< >
分享
最佳答案
0

timeStamp是个时间吧,你new 一个date对象。它应该 有方法返回从某一时刻到现在的毫秒数,就是timestamp

收获园豆:10
angelshelter | 大侠五级 |园豆:9887 | 2013-10-15 20:24
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册