Código fuente de 'Informe de objetos.asp'

<html>

<head>
<title>Informe de objetos - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
</head>



<% 'This ASP script originally lived at http://evolvedcode.net/ for the 
'original version of this script and a wide variety of other
'scripts, please visit the site.

'Option Explicit

Function GetHiLo( ByRef bMark )
'Simple function to select & toggle the background shading
' between the high color and the low color

If bMark Then
	GetHiLo = "ColorHi"
Else
	GetHiLo = "ColorLo"
End If

'Invert the current selection
bMark = Not bMark

End Function

Function ComplexFilter( ByVal objData )
'Code to handle situations where we have been passed complex data

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

'Take measures to ensure that this page is the most
' current page and not a cached version of it
Response.AddHeader "Cache-Control", "no-cache"
Response.Expires = -1
Response.CacheControl = "no-cache"

'Set the variable which we use to track hi/lo toggle
bMark = False
%>

  
  <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 style="font-family: Arial; font-size: 9pt">




<h1 align="center"><font face="Arial" size="4">Informe de objetos</font></h1>
<br><ul>
  <li><a href="#Server">Server Variables</a></li>
  <li><a href="#Application">Objeto de aplicación</a></li>
  <li><a href="#Session">Objeto de sesión</a></li>
  <li><a href="#Cookies">Cookie</a></li>
  <li><a href="#Form">Objeto de formulario</a></li>
  <li><a href="#Query">Objeto querystring</a></li>
</ul>

<!-- Server Variables -->
<a name="Server"></a>
<h2>Variables de servidor (Server variables)</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr class="HeadCell">
    <td width="25%">Nombre de ítem</td>
    <td>Valor</td>
  </tr>
<%
'Cycle through all the items that compose the server
' variables collection
For i = 1 To Request.ServerVariables.Count

	'Store the key name and the associated item value to 
	' variables
	sKey   = Request.ServerVariables.Key(i)
	sValue = Request.ServerVariables.Item(i)
	
	'Tidy them up as needed
	If sKey = vbNullString Then
		sKey = "&nbsp;"
	End If
	If sValue = vbNullString Then
		sValue = "&nbsp;"
	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 the 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><br>
<br>
Objeto de aplicación (Object application)</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr class="HeadCell">
    <td width="25%">Nombre de ítem</td>
    <td>Valor</td>
  </tr>
<%
If Application.Contents.Count = 0 Then
	'Nothing in session
%>
  <tr class="<%= GetHiLo( bMark ) %>">
    <td colspan="2">No data is currently being held in the application object!</td>
  </tr>
<%
Else

	'Cycle through all the items that compose the server
	' variables collection
	For i = 1 To Application.Contents.Count
	  
%>
  <tr class="<%= GetHiLo( bMark ) %>">
<%		
		'Handle display based on the type of object
		' that it contains
		If IsObject( Application.Contents.Item(i) ) Then
			'Contains an object variable of some type
			' or other, output the name and state it is an 
			' object
%>
    <td class="LeadCell"><%= Application.Contents.Key(i) %></td>
    <td>=Object=</td>
<%
		ElseIf IsArray( Application.Contents.Item(i) ) Then
			'Contains an array of objects, start by displaying
			' the array name then cycle through the array
			' and display them (note: assumes they are literals 
			' in a single dimensional array)
%>
    <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
			'Contains a NULL value
%>
    <td class="LeadCell"><%= Application.Contents.Key(i) %></td>
    <td>NULL</td>
<%
		ElseIf Application.Contents.Item(i) = vbNullString Or IsEmpty( Application.Contents.Item(i) ) Then
			'Contains an empty string or an empty variable
%>
    <td class="LeadCell"><%= Application.Contents.Key(i) %></td>
    <td>=Empty=</td>
<%
		Else
			'Anything not covered by the above tests,
			' treat it as a straight literal variable and
			' display its name and value
%>
    <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><br>
Objeto de sesión (Session Object)</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr class="HeadCell">
    <td width="25%">Property</td>
    <td>Valor</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">&nbsp;</td>
  </tr>
  <tr class="HeadCell">
    <td width="25%">Key Name</td>
    <td>Valor</td>
  </tr>

<%
'Once the default contents of the session have been output
' move on to the user-defined items.

'Check the session actually has something in it
If Session.Contents.Count = 0 Then
	'Nothing in session
%>
  <tr class="<%= GetHiLo( bMark ) %>">
    <td colspan="2">No hay datos en el objeto sesión</td>
  </tr>
<%
Else
	
	'Cycle through each of the user-defined items
	For i = 1 To Session.Contents.Count
%>
  <tr class="<%= GetHiLo( bMark ) %>">
<%		
		'Handle display based on the type of object
		' that it contains
		If IsObject( Session.Contents.Item(i) ) Then
			'Contains an object variable of some type
			' or other, output the name and state it is an 
			' object
%>
    <td class="LeadCell"><%= Session.Contents.Key(i) %></td>
    <td>=Object=</td>
<%
		ElseIf IsArray( Session.Contents.Item(i) ) Then
			'Contains an array of objects, start by displaying
			' the array name then cycle through the array
			' and display them (note: assumes they are literals 
			' in a single dimensional array)
%>
    <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
			'Contains a NULL value
%>
    <td class="LeadCell"><%= Session.Contents.Key(i) %></td>
    <td>=NULL=</td>
<%
		ElseIf Session.Contents.Item(i) = vbNullString Or IsEmpty( Session.Contents.Item(i) ) Then
			'Contains an empty variable or an empty string
%>
    <td class="LeadCell"><%= Session.Contents.Key(i) %></td>
    <td>=Empty=</td>
<%
		Else
			'Anything not covered by the above tests,
			' treat it as a straight literal variable and
			' display its name and value
%>
    <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><br>
Cookie (Cookie Object)</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr class="HeadCell">
    <td width="25%">Key Name</td>
    <td>Valor</td>
  </tr><%

'Check we actually have some user-defined cookies
' available to us
If Request.Cookies.Count > 0 Then

	'Cookies were found, cycle through each cookie 
	' displaying their content
	For i = 1 To Request.Cookies.Count
		
		'Store the name and value
		sCookie = Request.Cookies.Key(i)
		sValue = Request.Cookies.Item(i)
		
		'Test if value holds multiple sub-keys
		If InStr( 1, sValue, "&" ) > 0 And InStr( 1, sValue, "=" ) > 0 Then
		
			'Value does contain multiple sub-keys,
			' cycle through each sub-key and display its 
			' name and value in turn
			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
			'Value holds just one item
%>
  <tr class="<%= GetHiLo( bMark ) %>">
    <td class="LeadCell"><%= sCookie %></td>
    <td><%= sValue %></td>    
  </tr><%
		End If
	Next
Else
	'No cookies were found
%>
  <tr class="<%= GetHiLo( bMark ) %>">
    <td colspan="2">Ninguna cookie disponible</td>    
  </tr>
<%
End If
%>
</table>
<!-- Cookies -->
<p></p>

<!-- Form -->
<a name="Form"></a>
<h2><br>
Objeto de formulario (Form Object)</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr class="HeadCell">
    <td width="25%">Nombre de ítem</td>
    <td>Valor</td>
  </tr>
<%
'Check if data was supplied via the form
If Request.Form.Count > 0 Then

	'Since we appear to have data, cycle through all items supplied to us,
	' writing out the key name and the value of that 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

	'No data was supplied via this method
%>
  <tr class="<%= GetHiLo( bMark ) %>">
    <td colspan="2">Ningún dato fue suministrado via objeto de formulario</td>
  </tr>
<%
End If
%>
</table>
<!-- Form -->
<p></P>
<!-- QueryString -->
<a name="Query"></a>
<h2><br>
Objeto QueryString (QueryString Object)</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr class="HeadCell">
    <td width="25%">Nombre de ítem</td>
    <td>Valor</td>
  </tr>
<%
'Check if data was supplied via the querystring
If Request.QueryString.Count > 0 Then

	'Since we appear to have data, cycle through all items supplied to us,
	' writing out the key name and the value of that 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

	'No data was supplied via this method
%>
  <tr class="<%= GetHiLo( bMark ) %>">
    <td colspan="2">Ningún dato fue suministrado via objeto querystring</td>
  </tr>
<%
End If
%>
</table>
<!-- QueryString -->

</body>
</html>