实名认证用户熊川湘 身份证号码430811198506290914

cookie无法读取的问题

今天在本地测试的时候,发现了cookie无法读取的问题。cookie集合里没有先前的cookie信息。源码如下:

 //处理COOKIES
                    HttpCookie cookie5 = HttpContext.Current.Request.Cookies["MyCook"];
                    if (cookie5 == null)
                    {
                        cookie5 = new HttpCookie("MyCook");
                        cookie5.Domain = Domain;
                        cookie5.Values.Add("UserName", CommonMethod.Encode(_username, SecureKey));
                        cookie5.Values.Add("UserPass", CommonMethod.Encode(_userPassword, SecureKey));
                        cookie5.Values.Add("Key", CommonMethod.Encode(Clients.CookiesKey, SecureKey));
                        cookie5.Values.Add("UserIP", CommonMethod.Encode(Clients.IP, SecureKey));
                        cookie5.Expires = DateTime.Now.AddMinutes(30);
                        HttpContext.Current.Response.AppendCookie(cookie5);
                    }

 

一个上午都在处理这个问题,应是没找到原因错误。后面我把cookie5.Domain = Domain;这个注释掉,后面就好了,因为是在本地。特此把记录下来,好为以后提个醒

posted @ 2010-08-12 14:52  浪达短信群发  阅读(333)  评论(0编辑  收藏  举报