日期:2014-05-20  浏览次数:20551 次

asp.net cook奇怪的问题,
FormsAuthenticationTicket   tk   =   new   FormsAuthenticationTicket(
                                                                                1,                                 //指定版本号:可随意指定
                                                                        memberid.ToString(),   //登录用户名:对应   Web.config   中   <allow   users= "Admin "   …   />   的   users   属性
                                                                                System.DateTime.Now,       //发布时间
                                                                                System.DateTime.Now.AddYears(100),       //失效时间:100   年以后,够永够久了吧
                                                                        true,
                                                                        “我的信息”   //用户数据:可用   ((System.Web.Security.FormsIdentity)User.Identity).Ticket.UserData   获取
                                      );
                                //HttpContext.Current.Items[ "UseInfo "]   =   null;//reset   the   infor

                                string   str   =   FormsAuthentication.Encrypt(tk);//加密身份验票
                               
                                System.Web.HttpCookie   ck   =   new   HttpCookie(FormsAuthentication.FormsCookieName,   str);
我在login页面里面在userData里面放入我的信息,

                void   application_AuthenticateRequest(object   sender,   EventArgs   e)
                {
                        HttpApplication   application   =   (HttpApplication)sender;
                        HttpContext   context   =   application.Context;