Problem with asp.net forms authentication in internet explorer

后端 未结 7 571
伪装坚强ぢ
伪装坚强ぢ 2020-12-19 18:41

My company has a web application hosted on a client\'s machine that uses forms authentication in ASP.net. When visiting the website http://www.client.com/Application and tr

7条回答
  •  既然无缘
    2020-12-19 19:15

    Use this way:

    int timeoutValue = 20; // This value is actually returned from a method;
    FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(txtLogin.Text, false, timeoutValue);            
    string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
    HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);                 
    authCookie.Domain = "uptime.com.br";
    authCookie.Expires = DateTime.Now.AddMinutes(timeoutValue);
    HttpContext.Current.Response.Cookies.Add(authCookie);  
    

提交回复
热议问题