7. FrmStateShow.aspx.cs 파일을 열고 다음과 같이 코드를 작성한다.

    ▼  FrmStateShow.aspx.cs

    using System;
    
    namespace DevStateManagement
    {
      public partial class FrmStateShow : System.Web.UI.Page
      {
          protected void Page_Load(object sender, EventArgs e)
          {
              this.txtApplication.Text = Application[“Now”].ToString();
              
              this.txtSession.Text = Session[“Now”].ToString();
              
              if (Cache[“Now”] != null)
              {
                  this.txtCache.Text = Cache[“Now”].ToString();
              }
              
              if (Request.Cookies[“Now”] != null)
              {
                  this.txtCookies.Text =
                      Server.UrlDecode(Request.Cookies[“Now”].Value);
              }
              
              // 뷰상태 개체는 해당 페이지에서만 살아있는 변수다.
              if (ViewState[“Now”] != null)
              {
                  this.txtViewState.Text = ViewState[“Now”].ToString();
              }
          }
      }
    }
    

    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.