window.showModalDialog의 Page_Load 문제 해결

[증상]
window.showModalDialog로 새창을 띠울 경우 Page_Load 이벤트가 최초 한번만
일어나고 다음에 다음에 새창을 띠워도 페이지가 캐쉬되는 현상이 발생합니다.

[원인]
page에 대한 cache가 존재하기 때문에 발생되는 문제이다.

[해결방법]
1. 페이지의 Page_Load 이벤트에서 마지막 행에 아래 문장을 넣어 준다.

Response.Expires = 0;
Response.Cache.SetNoStore();
Response.AppendHeader("Pragma", "no-cache");


(예)
private void Page_Load(object sender, System.EventArgs e)
{
   if(!IsPostBack)
   {
     // 코드 삽입
   }

   Response.Expires = 0;
   Response.Cache.SetNoStore();
   Response.AppendHeader("Pragma", "no-cache");

 
2. 페이지의 head 태그에 아래 문장을 삽입한다.
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-reval!idate">
<meta http-equiv="Pragma" content="No-Cache">
<meta http-equiv="Expires" content="Mon, 06 Jan 1990 00:00:01 GMT">

이 글과 관련있는 글을 자동검색한 결과입니다 [?]

by poco | 2008/01/21 08:12 | 트랙백 | 덧글(1)

트랙백 주소 : http://poco.egloos.com/tb/1316654
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]
Commented by 지오준 at 2009/08/28 13:49
좋은 정보 감사합니다. 잘보고 갑니다 ^^

:         :

:

비공개 덧글

◀ 이전 페이지다음 페이지 ▶