728x90
728x170
▶ MainPage.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainPage.aspx.cs" Inherits="TestProject.MainPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HttpCachePolicy 클래스 : 코드 기반 캐시 사용하기</title>
</head>
<body>
<form id="form" runat="server">
<div />
</form>
</body>
</html>
728x90
▶ MainPage.aspx.cs
using System;
using System.Web;
using System.Web.UI;
namespace TestProject
{
/// <summary>
/// 메인 페이지
/// </summary>
public partial class MainPage : Page
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Protected
#region 페이지 로드시 처리하기 - Page_Load(sender, e)
/// <summary>
/// 페이지 로드시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(DateTime.Now.ToString());
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.VaryByParams["*"] = true;
}
#endregion
}
}
728x90
그리드형(광고전용)
'C# > ASP.NET' 카테고리의 다른 글
[C#/ASP.NET] SqlDataSource 클래스 사용하기 (0) | 2019.12.17 |
---|---|
[C#/ASP.NET] DropDownList 클래스 : DataSourceID 속성을 사용해 데이터 소스 바인딩하기 (0) | 2019.12.17 |
[C#/ASP.NET] GridView 클래스 사용하기 (0) | 2019.12.16 |
[C#/ASP.NET] WebConfigurationManager 클래스 : 설정 정보 구하기 (0) | 2019.12.16 |
[C#/ASP.NET] ConfigurationManager 클래스 : 설정 정보 구하기 (0) | 2019.12.16 |
[C#/ASP.NET] OutputCache 지시자 : 캐시 사용하기 (0) | 2019.12.15 |
[C#/ASP.NET] Page 클래스 : Application 속성을 사용해 현재 접속자 수 표시하기 (0) | 2019.12.15 |
[C#/ASP.NET] ASP.NET이 제공하는 상태 관리 기법 (0) | 2019.12.15 |
[C#/ASP.NET] TreeView 클래스 : DataSourceID 속성을 사용해 사이트맵 트리 구조 만들기 (0) | 2019.12.14 |
[C#/ASP.NET] TreeView 클래스 사용하기 (0) | 2019.12.14 |