2010-12-01 7 views
0

나는 쿠키가 때 사용자의 LOGES :ASP.Net 쿠키 문제

HttpCookie cookie = new HttpCookie("Username"); 
        cookie.Expires = DateTime.Now.AddDays(1.0); 
        cookie.Value = txtUsername.Text; 
        Response.Cookies.Add(cookie); 

하고 때 사용자의 방문을 다시 로그인 페이지에서 읽

if (Response.Cookies["Username"] != null) txtUsername.Text = Response.Cookies["Username"].Value; 

을하지만 때 내가 로그인 한 후 직접 로그 아웃하면 쿠키가 삭제됩니다. 그것은 만기 날짜도 저장 값도 없다.

내가 틀린가요?

+0

해야 하는가? Firebug for Firefox와 같은 브라우저 내장 개발자 도구를 사용하여 클라이언트에서 쿠키가 어떻게 발생하는지 모니터링 했습니까? –

답변

6
if (Response.Cookies["Username"] != null) txtUsername.Text = Response.Cookies["Username"].Value 

어떻게 당신이 테스트

if (Request.Cookies["Username"] != null) txtUsername.Text = Request.Cookies["Username"].Value