先set,在转向吧
FormsAuthentication.SetAuthCookie(this.txtUserID.Text, true);
Response.Redirect("FrmMain.aspx");
不过,一般我都是这样写的
Response.Redirect(FormsAuthentication.GetRedirectUrl(this.txtUserID.Text, true));

解决方案 »

  1.   

    HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
      DateTime now = DateTime.Now;
      authCookie.Value = now.ToString();
      authCookie.Expires = now.AddHours(10);
      Response.Cookies.Add(authCookie);
    在客户端差生Cookies,内容包括失效时间等信息。
    不过再使用FormsAuthentication.SetAuthCookie(),将会改变Cookies的内容,个人觉得之前的工作没意义了。