title: Reading cookies in VB with an encrypted cookie from php
body: <p>I have a VB.NET website that needs to be called from a php script and will be passed a cookie in the header. First some code samples and my question is at the end.</p>
  <p>php calling script:</p>
  <pre><code>    &lt;form name=&quot;WIP&quot; method=&quot;post&quot; action=&quot;https://somesite.space/defaulttest.aspx&quot; id=&quot;new_user_session&quot; target=&quot;_blank&quot;&gt;
      &lt;input type=&quot;input&quot; id=&quot;user_session_username_input&quot; name=&quot;user_session[username]&quot;  value='&lt;?php echo $_COOKIE[&quot;username&quot;];?&gt;' /&gt;
      &lt;input type=&quot;input&quot; id=&quot;user_session_password_input&quot; name=&quot;user_session[password]&quot;  value='&lt;?php echo $_COOKIE[&quot;password&quot;];?&gt;' /&gt;
      &lt;button type=&quot;submit&quot; name=&quot;callwip&quot;&gt;hidden submit button&lt;/button&gt;
      &lt;/form&gt;
  </code></pre>
  <p>PHP script to display header info:</p>
  <pre><code>    &lt;?php
      function getRequestHeaders() {
          $headers = array();
          foreach($_SERVER as $key =&gt; $value) {
              if (substr($key, 0, 5) &lt;&gt; 'HTTP_') {
                  continue;
              }
              $header = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5)))));
              $headers[$header] = $value;
          }
          return $headers;
      }
      
      $headers = getRequestHeaders();
      
      foreach ($headers as $header =&gt; $value) {
          echo &quot;$header: $value &lt;br /&gt;\n&quot;;
          
          echo htmlspecialchars($_COOKIE[&quot;name&quot;]) ,
      }   
  </code></pre>
  <p>The PHP script displays
  the cookie as such:</p>
  <blockquote>
  <p>Cookie:ASPXANONYMOUS=zJOR0PPn1wEkAAAANTM4MjVmNTgtNjBmZi00OTE5LWJhMDctMzZhNDE2MzNiMjhmJMtw8PE9cOVf21RLcsEj_oGjnQk1</p>
  </blockquote>
  <p>VB test script:</p>
  <pre><code>    Imports System.Data
      Imports System.Data.SqlClient
      Imports DataHelper
      
      Partial Class _Default
          Inherits System.Web.UI.Page
      
          Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
              lblnameText.Text = Request.QueryString(&quot;id&quot;)
              lblpasswordText.Text = Request.QueryString(&quot;name&quot;)
              lblWelcomeText.Text = Request.AnonymousID
          End Sub
      End Class
  </code></pre>
  <p>The .aspx for the vb code just has 3 labels for testing purposes. I read somewhere that I needed to use Request.AnonymousID to get the cookie data. All I get is what looks like a GUID:9b203463-6c26-4f72-ba42-58c6d069447c. The Request.QueryString(&quot;id&quot;) and Request.QueryString(&quot;name&quot;) return nothing.
  Nothing like the cookie I seen in the php test results which could well be my name and password values encrypted.</p>
  <p>Finally for my question, I assume the calling script is encrypting the data somehow though I don't see where it happens. How do I decrypt it or even get the encrypted string in VB?</p>
  <p>I think I am missing a thing or 20...
  BTW this is my first time using cookies as well as the first time from one language to another.</p>