FormsAuthentication.RedirectFromLoginPage(sLoginID,CheckBox1.Checked);
FormsAuthentication.SetAuthCookie(sLoginID,true);以上2句用1句旧可以了吗?
  设置以后,我在其他页面中如果想得到设置的sLoginID值,应该如何获取?

解决方案 »

  1.   

    httpcontext.Current.User.Identity.Name
      

  2.   

    FormsAuthentication.RedirectFromLoginPage(sLoginID,CheckBox1.Checked);
    FormsAuthentication.SetAuthCookie(sLoginID,true);
    你的第二句话是没用的,有第一句就可以了。
      

  3.   

    FormsAuthentication.GetAuthCookie(string, bool);
      

  4.   

    if(System.Web.Security.FormsAuthentication.GetAuthCookie("sLoginID",false)!=null)
    {
    string str=Request.CookiesSystem.Web.Security.FormsAuthentication.FormsCookieName].Value;
    FormsAuthenticationTicket ticket=FormsAuthentication.Decrypt(str);
    Response.Write("当前登陆用户:"+ticket.Name);
    }
      

  5.   

    if(System.Web.Security.FormsAuthentication.GetAuthCookie("sLoginID",false)!=null)
    {
    string str=
    Request.Cookies[System.Web.Security.FormsAuthentication.FormsCookieName].Value;
    FormsAuthenticationTicket ticket=FormsAuthentication.Decrypt(str);
    Response.Write("当前登陆用户:"+ticket.Name);
    }
      

  6.   

    问楼上,
    ticket.Name="用户名"=System.Web.Security.FormsAuthentication.GetAuthCookie("用户名",false)
      

  7.   

    httpcontext.Current.User.Identity.Name
      

  8.   

    httpcontext.Current.User.Identity.Name
      

  9.   

    httpcontext.Current.User.Identity.Name