ASP Contents Koleksiyonu

Application Nesnesi Referans Kılavuzu

Contents koleksiyonu, uygulama/oturum'a eklenen tüm projeleri içerir.

İpucu:Contents koleksiyonundan bir öğeyi kaldırmak için Remove ve RemoveAll yöntemlerini kullanın.

gramer

Application.Contents(Anahtar)
Session.Contents(Anahtar)
parametre tanım
anahtar Gerekli. Dönüştürülecek öğenin adı.

Application nesnesi için örnek

Örnek 1

Lütfen dikkat edin, name ve objtest hem Contents koleksiyonuna eklenecektir:

<% 
Application("name")="W3School"
Set Application("objtest")=Server.CreateObject("ADODB.Connection")
%>

Örnek 2

Contents koleksiyonunu tarayın:

<%
for each x in Application.Contents
  Response.Write(x & "=" & Application.Contents(x) & "<br />")
next
%>

veya:

<%
For i=1 to Application.Contents.Count
  Response.Write(i & "=" & Application.Contents(i) & "<br />")
Sonraki
%>

Örnek 3

<%
Application("date")="2001/05/05"
Application("author")="W3School"
for each x in Application.Contents
  Response.Write(x & "=" & Application.Contents(x) & "<br />")
next
%>

Çıktı:

date=2001/05/05
yazar=W3School

Session nesnesi için örnek

Örnek 1

Lütfen dikkat edin, name ve objtest hem Contents koleksiyonuna eklenecektir:

<% 
Session("name")="Hege"
Set Session("objtest")=Server.CreateObject("ADODB.Connection")
%>

Örnek 2

Contents koleksiyonunu tarayın:

<%
for each x in Session.Contents
  Response.Write(x & "=" & Session.Contents(x) & "<br />")
next
%>

veya:

<%
For i=1 to Session.Contents.Count
  Response.Write(i & "=" & Session.Contents(i) & "<br />")
Sonraki
%>

Örnek 3

<%
Session("name")="Hege"
Session("date")="2001/05/05"
for each x in Session.Contents
  Response.Write(x & "=" & Session.Contents(x) & "<br />")
next
%>

Çıktı:

name=Hege
date=2001/05/05

Application Nesnesi Referans Kılavuzu