Global.asax
protected void Application_Start(object sender, EventArgs e)
{
Application.Add("OnlineZiyaretciSayisi", 0);
}
protected void Session_Start(object sender, EventArgs e)
{
Application.Lock();
Application["OnlineZiyaretciSayisi"] = (int)Application["OnlineZiyaretciSayisi"] + 1;
Application.UnLock();
}
protected void Session_End(object sender, EventArgs e)
{
Application.Lock();
Application["OnlineZiyaretciSayisi"] = (int)Application["OnlineZiyaretciSayisi"] - 1;
Application.UnLock();
}
protected void Application_End(object sender, EventArgs e)
{
Application.Remove("OnlineZiyaretciSayisi");
}
Sayfa içinde aşağıdaki kod yerleşecek
<%=Application["OnlineZiyaretciSayisi"]%>
Hiç yorum yok:
Yorum Gönder