global.asax파일에 전역변수 설정 및 사용
//사용 예1
asax ============
Application.Lock();
Application["VENDER_CD_01"] = "0000001001";
Application["VENDER_NM_01"] = "OO교육원";
Application["WORK_GUBN_01"] = "S00001";
Application["CAT_ID_01"] = "0000001001";
Application.UnLock();
aspx ===============
<%= Application["VENDER_NM_01"] %>
aspx.cs ============
Response.Write(Application["VENDER_NM_01"].ToString());
//사용 예2(해시테이블사용)
asax ============
protected void Application_Start(object sender, EventArgs e)
{
Hashtable ht = new Hashtable();
Application.Lock();
ht["test01"] = "1";
ht["test02"] = "2";
Application["test"] = ht;
Application.UnLock();
}
aspx.cs ===============
protected void Page_Load(object sender, EventArgs e)
{
Hashtable ht = Application["test"] as Hashtable;
Response.Write(string.Format("test01 : {0}<br/>", ht["test01"]));
Response.Write(string.Format("test02 : {0}<br/>", ht["test02"]));
}