ASP İçerik Koleksiyonu
❮ Uygulama Nesne Referansını Tamamlayın
Contents koleksiyonu, bir komut dosyası komutu aracılığıyla uygulamaya/oturuma eklenen tüm öğeleri içerir.
İpucu: Öğeleri Contents koleksiyonundan kaldırmak için RemoveAll ve RemoveAll yöntemlerini kullanın.
Sözdizimi
Application.Contents(Key)
Session.Contents(Key)
Parameter | Description |
---|---|
key | Required. The name of the item to retrieve |
Uygulama Nesnesi için Örnekler
örnek 1
Contents koleksiyonuna hem name hem de objtest ekleneceğine dikkat edin:
<%
Application("name")="W3Schools"
Set Application("objtest")=Server.CreateObject("ADODB.Connection")
%>
Örnek 2
İçindekiler koleksiyonunda dolaşmak için:
<%
for each x in Application.Contents
Response.Write(x & "=" & Application.Contents(x) & "<br>")
next
%>
or:
<%
For i=1 to Application.Contents.Count
Response.Write(i & "=" & Application.Contents(i) & "<br>")
Next
%>
Örnek 3
<%
Application("date")="2001/05/05"
Application("author")="W3Schools"
for each x in Application.Contents
Response.Write(x & "=" & Application.Contents(x) & "<br>")
next
%>
Output:
date=2001/05/05
author=W3Schools
Oturum Nesnesi için Örnekler
örnek 1
Contents koleksiyonuna hem name hem de objtest ekleneceğine dikkat edin:
<%
Session("name")="Hege"
Set Session("objtest")=Server.CreateObject("ADODB.Connection")
%>
Örnek 2
İçindekiler koleksiyonunda dolaşmak için:
<%
for each x in Session.Contents
Response.Write(x & "=" & Session.Contents(x) & "<br>")
next
%>
or:
<%
For i=1 to Session.Contents.Count
Response.Write(i & "=" & Session.Contents(i) & "<br>")
Next
%>
Örnek 3
<%
Session("name")="Hege"
Session("date")="2001/05/05"
for each x in Session.Contents
Response.Write(x & "=" & Session.Contents(x) & "<br>")
next
%>
Output:
name=Hege
date=2001/05/05
❮ Uygulama Nesne Referansını Tamamlayın