2008년 01월 21일
window.showModalDialog의 Page_Load 문제 해결
[증상]
window.showModalDialog로 새창을 띠울 경우 Page_Load 이벤트가 최초 한번만
일어나고 다음에 다음에 새창을 띠워도 페이지가 캐쉬되는 현상이 발생합니다.
[원인]
page에 대한 cache가 존재하기 때문에 발생되는 문제이다.
[해결방법]
1. 페이지의 Page_Load 이벤트에서 마지막 행에 아래 문장을 넣어 준다.
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">
이 글과 관련있는 글을 자동검색한 결과입니다 [?]
- .net framework 설치 유무 판단하는 소스 by Hot K
- HTTP File download by 한머리
- MasterPage 동적 변경 by 가브햄
- C# 시작 프로그램 잇힝 by 배드문
- Button 자동생성2 by 온스토리닷넷
# by | 2008/01/21 08:12 | 트랙백 | 덧글(1)





☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]