当前位置:编程学习 > C#/ASP.NET >>

asp.net的cookie问题

cookie在firefox下可以保存 在ie下不可以保存
同样的程序 换一个服务器 cookie在firefox和ie都可以保存了
大致的代码如下:
设置cookie:
string username="ffff";
FormsAuthentication.SetAuthCookie(username, true);
Response.Cookies[FormsAuthentication.FormsCookieName].Expires = DateTime.Now.AddDays(1);

判断cookie:
 if (Request.Cookies[FormsAuthentication.FormsCookieName] != null)
        {
            string str = Request.Cookies[FormsAuthentication.FormsCookieName].Value;

            ticket = FormsAuthentication.Decrypt(str);

            if (!string.IsNullOrEmpty(ticket.Name))
            {
                cookieflag = true;
                username = ticket.Name;
            }
        }
网址http://202.120.40.70/cjet 用户名:cooleagle 密码:654321 在firefox下可以正常登录,并保存cookie,但在ie下比可以。同样的网站程序 放到别的服务器上一切正常。不清楚是否是iis的问题,请高手指点,谢谢!
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,