Variáveis de servidor
objeto da sessão
objeto Form
objeto querystring
cookies objeto
Pode ser usado tanto como uma ferramenta stand-alone de diagnóstico que vai simplesmente mostrar o atual estado dinâmico dos itens, ou como um ponto final para testar os dados do formulário ao mesmo tempo mostrando itens atuais do estado dinâmico.
<%
Option Explicit
Function GetHiLo( ByRef bMark )
If bMark Then
GetHiLo = "ColorHi"
Else
GetHiLo = "ColorLo"
End If
bMark = Not bMark
End Function
Function ComplexFilter( ByVal objData )
If IsArray( objData )Then
ComplexFilter = "<< Array >>"
ElseIf IsObject( objData )Then
ComplexFilter = "<< Object >>"
ElseIf IsNull( objData )Then
ComplexFilter = "<< Null >>"
ElseIf IsEmpty( objData )Then
ComplexFilter = "<< Empty >>"
Else
ComplexFilter = objData
End If
End Function
Dim i, j, sKey, sValue, bMark
Dim sTmp, sCookie, objArray
Response.AddHeader "Cache-Control", "no-cache"
Response.Expires = -1
Response.CacheControl = "no-cache"
bMark = False
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>State Diagnostics</title>
<style>
<!--
body {
Font-Family: Tahoma, Arial;
Font-Size: 9pt;
}
td {
Font-Family: Tahoma, Arial;
Font-Size: 9pt;
Align: justify;
Vertical-Align: Top;
}
h1 {
Font-Family: Tahoma, Arial;
Font-Size: 16pt;
}
h2 {
Font-Family: Tahoma, Arial;
Font-Size: 12pt;
}
.Header {
Font-Size: 18pt;
Text-Align: Center;
}
.SubHeader {
Font-Size: 14pt;
Text-Align: Center;
}
.LeadCell {
Font-Weight: Bold;
}
.HeadCell {
Font-Weight: Bold;
Background-Color: #D5D5D5;
}
a,a:Link,a:Active {
Color: DarkRed;
Text-Decoration: None;
}
a:Hover {
Color: DarkRed;
Text-Decoration: Underline;
}
.ColorHi {
Background-Color: #FFF7D3;
}
.ColorLo {
Background-Color: #FFF4BD;
}
-->
</style>
</head>
<body>
<h1>Mostrar Estado dinâmico</h1>
<ul>
<li><a href="#Server">Server Variables</a></li>
<li><a href="#Application">Application Object</a></li>
<li><a href="#Session">Session Object</a></li>
<li><a href="#Cookies">Cookie Object</a></li>
<li><a href="#Form">Form Object</a></li>
<li><a href="#Query">QueryString Object</a></li>
</ul>
<!-- Server Variables -->
<a name="Server"></a>
<h2>Server Variables</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr class="HeadCell">
<td width="25%">Nome do Item </td>
<td>Value</td>
</tr>
<%
For i = 1 To Request.ServerVariables.Count
'Armazenar o nome da chave e o valor do item associado a variáveis
sKey = Request.ServerVariables.Key(i)
sValue = Request.ServerVariables.Item(i)
'Tidy them up as needed
If sKey = vbNullString Then
sKey = " "
End If
If sValue = vbNullString Then
sValue = " "
End If
If Left( sKey, 4 ) = "ALL_" Then
sValue = Replace( sValue, vbCrLf, "<br />" )
sValue = Replace( sValue, vbCr, "<br />" )
sValue = Replace( sValue, vbLf, "<br />" )
End If
'Display o item
%>
<tr class="<%= GetHiLo( bMark ) %>">
<td class="LeadCell"><%= sKey %></td>
<td><%= sValue %></td>
</tr><%
Next
%>
</table>
<!-- Server Variables -->
<p></p>
<!-- Application Object -->
<a name="Application"></a>
<h2>Application Object</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr class="HeadCell">
<td width="25%">Nome do Item </td>
<td>Value</td>
</tr>
<%
If Application.Contents.Count = 0 Then
'Nothing em session
%>
<tr class="<%= GetHiLo( bMark ) %>">
<td colspan="2">Não há dados está sendo realizada em objeto aplicação!</td>
</tr>
<%
Else
'percorrer todos os itens que compõem o servidor,Coleção de variáveis
For i = 1 To Application.Contents.Count
%>
<tr class="<%= GetHiLo( bMark ) %>">
<%
'Lidar com exibição com base no tipo de objeto,Que contém
If IsObject( Application.Contents.Item(i) ) Then
%>
<td class="LeadCell"><%= Application.Contents.Key(i) %></td>
<td>=Object=</td>
<%
ElseIf IsArray( Application.Contents.Item(i) ) Then
%>
<td class="LeadCell">Array: <%= Application.Contents.Key(i) %>( <%= LBound( Application.Contents.Item(i) ) %> To <%= UBound( Application.Contents.Item(i) ) %> )</td>
<%
For Each objArray In Application.Contents.Item(i)
If IsArray( objArray ) Then
objArray = "=Array="
ElseIf IsObject( objArray ) Then
objArray = "=Object="
ElseIf IsNull( objArray ) Then
objArray = "=NULL="
ElseIf objArray = vbNullString Or IsEmpty( objArray ) Then
objArray = "=Empty="
End If
%>
<td colspan="2"><%= objArray %></td>
<%
Next
ElseIf IsNull( Application.Contents.Item(i) ) Then
'Contém um valor NULL
%>
<td class="LeadCell"><%= Application.Contents.Key(i) %></td>
<td>NULL</td>
<%
ElseIf Application.Contents.Item(i) = vbNullString Or IsEmpty( Application.Contents.Item(i) ) Then
'Contém uma seqüência vazia ou uma variável vazia
%>
<td class="LeadCell"><%= Application.Contents.Key(i) %></td>
<td>=Empty=</td>
<%
Else
%>
<td class="LeadCell"><%= Application.Contents.Key(i) %></td>
<td><%= Application.Contents.Item(i) %></td>
<%
End If
%>
</tr><%
Next
End If
%>
</table>
<!-- Application Object -->
<p></p>
<!-- Session Data -->
<a name="Session"></a>
<h2>Session Object</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr class="HeadCell">
<td width="25%">Propriedade</td>
<td>Value</td>
</tr>
<tr class="<%= GetHiLo( bMark ) %>">
<td class="LeadCell">Session ID</td>
<td><%= Session.SessionID %></td>
</tr>
<tr class="<%= GetHiLo( bMark ) %>">
<td class="LeadCell">Session Timeout</td>
<td><%= Session.Timeout %></td>
</tr>
<tr class="<%= GetHiLo( bMark ) %>">
<td class="LeadCell">Session Codepage</td>
<td><%= Session.CodePage %></td>
</tr>
<tr class="<%= GetHiLo( bMark ) %>">
<td class="LeadCell">Session Locale</td>
<td><%= Session.LCID %></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr class="HeadCell">
<td width="25%">Nome da Key </td>
<td>Value</td>
</tr>
<%
'Uma vez que o conteúdo padrão da sessão ter sido de saída
'Passar para os itens definidos pelo usuário.
'Verifique a sessão realmente tem algo nela
If Session.Contents.Count = 0 Then
'Nothing in session
%>
<tr class="<%= GetHiLo( bMark ) %>">
<td colspan="2">Não há dados está sendo realizada no objeto de sessão!</td>
</tr>
<%
Else
'Percorrer cada um dos itens definidos pelo usuário
For i = 1 To Session.Contents.Count
%>
<tr class="<%= GetHiLo( bMark ) %>">
<%
'Lidar com exibição com base no tipo de objeto,Que contém
If IsObject( Session.Contents.Item(i) ) Then
%>
<td class="LeadCell"><%= Session.Contents.Key(i) %></td>
<td>=Object=</td>
<%
ElseIf IsArray( Session.Contents.Item(i) ) Then
%>
<td class="LeadCell">Array: <%= Session.Contents.Key(i) %>( <%= LBound( Session.Contents.Item(i) ) %> To <%= UBound( Session.Contents.Item(i) ) %> )</td>
<td></td>
<%
For Each objArray In Session.Contents.Item(i)
If IsArray( objArray ) Then
objArray = "=Array="
ElseIf IsObject( objArray ) Then
objArray = "=Object="
ElseIf IsNull( objArray ) Then
objArray = "=NULL="
ElseIf objArray = vbNullString Or IsEmpty( objArray ) Then
objArray = "=Empty="
End If
%>
<td colspan="2"><%= objArray %></td>
<%
Next
ElseIf IsNull( Session.Contents.Item(i) ) Then
'Contém um valor NULL
%>
<td class="LeadCell"><%= Session.Contents.Key(i) %></td>
<td>=NULL=</td>
<%
ElseIf Session.Contents.Item(i) = vbNullString Or IsEmpty( Session.Contents.Item(i) ) Then
'Contém uma variável vazia ou uma string vazia
%>
<td class="LeadCell"><%= Session.Contents.Key(i) %></td>
<td>=Empty=</td>
<%
Else
%>
<td class="LeadCell"><%=Session.Contents.Key(i) %></td>
<td><%=Session.Contents.Item(i) %></td>
<%
End If
%>
</tr><%
Next
End If
%>
</table>
<!-- Session Data -->
<p></p>
<!-- Cookies -->
<a name="Cookies"></a>
<h2>Cookie Object</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr class="HeadCell">
<td width="25%">Nome da Key </td>
<td>Value</td>
</tr><%
'Check se realmente temos alguns cookies definidos pelo usuário
If Request.Cookies.Count > 0 Then
'Cookies foram encontrados ,exibir o seu conteúdo
For i = 1 To Request.Cookies.Count
'Armazenar o nome e valor
sCookie = Request.Cookies.Key(i)
sValue = Request.Cookies.Item(i)
'Teste se o valor tem várias sub-keys
If InStr( 1, sValue, "&" ) > 0 And InStr( 1, sValue, "=" ) > 0 Then
sTmp = Split( sValue, "&" )
For j = LBound( sTmp ) To UBound( sTmp )
sKey = Left( sTmp(j), InStr( 1, sTmp(j), "=" ) - 1 )
sValue = Right( sTmp(j), Len( sTmp(j) ) - InStr( 1, sTmp(j), "=" ) )
%>
<tr class="<%= GetHiLo( bMark ) %>">
<td class="LeadCell"><%= sCookie & " : " & sKey %></td>
<td><%= sValue %></td>
</tr><%
Next
Else
'Valor tem apenas um item
%>
<tr class="<%= GetHiLo( bMark ) %>">
<td class="LeadCell"><%= sCookie %></td>
<td><%= sValue %></td>
</tr><%
End If
Next
Else
'Os cookies não foram encontrados
%>
<tr class="<%= GetHiLo( bMark ) %>">
<td colspan="2">Os cookies não estão disponíveis!</td>
</tr>
<%
End If
%>
</table>
<!-- Cookies -->
<p></p>
<!-- Form -->
<a name="Form"></a>
<h2>Form Object</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr class="HeadCell">
<td width="25%">Nome do Item</td>
<td>Value</td>
</tr>
<%
'Check if data was supplied via the form
If Request.Form.Count > 0 Then
'Desde que parecem ter dados do ciclo, através de todos os itens que nos são fornecidos,
'Escrever o nome da chave eo valor do item
For i = 1 To Request.Form.Count
%>
<tr class="<%= GetHiLo( bMark ) %>">
<td class="LeadCell"><%= Request.Form.Key( i ) %></td>
<td><%= Request.Form.Item( i ) %></td>
</tr><%
Next
Else
'Nenhum dado foi fornecido através deste método
%>
<tr class="<%= GetHiLo( bMark ) %>">
<td colspan="2">Nenhum dado foi fornecido através do objeto de formulário!</td>
</tr>
<%
End If
%>
</table>
<!-- Form -->
<p></P>
<!-- QueryString -->
<a name="Query"></a>
<h2>QueryString Object</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr class="HeadCell">
<td width="25%">Nome do Item</td>
<td>Value</td>
</tr>
<%
'Verifique se os dados foram fornecidos via querystring
If Request.QueryString.Count > 0 Then
'Desde que parecem ter dados do ciclo, através de todos os itens que nos são fornecidos,
'Escrever o nome da chave e o valor do item
For i = 1 To Request.QueryString.Count
%>
<tr class="<%= GetHiLo( bMark ) %>">
<td class="LeadCell"><%= Request.QueryString.Key( i ) %></td>
<td><%= Request.QueryString.Item( i ) %></td>
</tr><%
Next
Else
%>
<tr class="<%= GetHiLo( bMark ) %>">
<td colspan="2">Nenhum dado foi fornecido através do objeto querystring!</td>
</tr>
<%
End If
%>
</table>
<!-- QueryString -->
</body>
</html>

Help














