ASP.NET 기초 강의실

시삽: 레드플러스 님 
게시판 이동:
 제목 : Response.Cache로 코드 레벨에서 페이지 캐싱 적용하기, 뒤로 가기 버튼 방지
글번호: 128
작성자: 레드플러스
작성일: 2005/04/21 오후 8:29:00
조회수: 5694
// MainNotice.ascx.cs에 적용
// 페이지 캐싱 : <%@ OutputCache Duration="60" VaryByParam="None" %>와 같음
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.VaryByParams["*"] = true;


=========================================

      //[!] 프로그래밍적으로 캐싱 설정
      // 코드 기반으로 캐싱 기능 적용하기
      Response.Write(DateTime.Now); // 현재 날짜 출력
      //[1] 캐싱 설정
      Response.Cache.SetCacheability(HttpCacheability.Public);
      //[2] 캐싱 유효기간 설정
      Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
      //[3] 매개 변수 방식 지정
      Response.Cache.VaryByParams["*"] = true;





===================================================
웹 브라우저 세션 종료 후 브라우저 뒤로가기 방지


<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">

또는

page load 이벤트 처리기에 아래와 같은 코드 기록


Response.Cache.SetAllowResponseInBrowserHistory(False)

Response.Cache.SetCacheability(HttpCacheability.NoCache)

Response.Cache.SetExpires(Now().AddSeconds(-1))

Response.Cache.SetNoStore()

Response.AddHeader("Pragma", "no-cache")

Response.Write("" & DateTime.Now.ToLongTimeString())
 
이전 글   다음 글 삭제 수정 답변 글쓰기 리스트


관련 아티클 리스트
  제       목 파일 작성자 작성일 조회
이전글 20. 사용 팁 모음 - 레드플러스 2004-01-27 5247
  19. ASP.NET 성능 향상 방법 : Caching - 레드플러스 2004-01-16 5899
  @OutputCache 디렉티브(Duration,VaryByParam)를 사용한 페이... - 레드플러스 2005-04-13 5266
  @OutputCache 디렉티브(Duration,VaryByControl)를 사용한 ... - 레드플러스 2005-04-21 4643
현재글 Response.Cache로 코드 레벨에서 페이지 캐싱 적용하기, 뒤로 가기 버튼 방... - 레드플러스 2005-04-21 5694
다음글 18. .NET 클래스 : E-Mail - 레드플러스 2003-12-24 5571
 
손님 사용자 Anonymous (손님)
로그인 Home