title: Loop through or access array of Strings
body: <p>I am trying to access the values of Session.Contents, some of which appear to be String Arrays.  </p>
  
  <p>I've tried to retrieve the values in these arrays using the code below and also directly:</p>
  
  <pre><code>Session.Contents.Item(sessItem)(1)
  </code></pre>
  
  <p>Both ways throw an error.  Based on <a href="https://stackoverflow.com/questions/4035513/how-can-i-convert-a-string-array-to-a-variant-array-in-vbscript">similar</a> <a href="https://stackoverflow.com/questions/47383823/how-to-access-string-type-in-vbscript">posts</a>, it seems like this just isn't possible in VBScript?  </p>
  
  <p>Line 92 corresponds to</p>
  
  <pre><code>For each x in Session.Contents.Item(sessItem)
  </code></pre>
  
  <p>I got the loop from <a href="https://msdn.microsoft.com/en-us/library/ms525093(v=vs.90).aspx" rel="nofollow noreferrer">Microsoft Documentation</a>, but the example code didn't dim objArray which worked well.</p>
  
  <pre><code>Dim sessItem,x
  For Each sessItem In Session.Contents 
  If IsArray(Session.Contents.Item(sessItem)) Then 
      Response.Write("Type of sessItem contents = " &amp; TypeName(Session.Contents(sessItem)) &amp; "  VarType = " &amp; VarType(Session.Contents(sessItem)) &amp;"&lt;br&gt;")
      Response.write sessItem &amp; " : an array of the following " &amp; UBound(Session.Contents.Item(sessItem))+1 &amp; " items &lt;BR&gt;" 
      For each x in Session.Contents.Item(sessItem) 
          Response.write "- " &amp; x &amp; "&lt;BR&gt;" 
      Next 
      ElseIf IsObject(Session.Contents.Item(sessItem)) Then 
          Response.write(sessItem &amp; " : Session object cannot be displayed." &amp; "&lt;BR&gt;") 
      Else 
          'Response.write(sessItem &amp; " : " &amp; CStr(Session.Contents.Item(sessItem)) &amp; "&lt;BR&gt;") 
      End If 
  Next 
  </code></pre>
  
  <p>Type of <code>sessItem</code> contents is <code>String()</code> (VarType = 8200).</p>
  
  <p>Cached_AccountDetails : an array of the following 11 items</p>
  
  <blockquote>
    <p>Microsoft VBScript runtime error '800a000d'<br>
    Type mismatch<br>
    Statement.asp, line 92</p>
  </blockquote>