title: Identifying underlying sql connection of SqlConnection object
body: <p>I can use GetHashCode() to identify an object but is there any way to identify the actual sql connection obtained by a SqlConnection object?</p>
  
  <p>I'm (still) trying to debug a problem involving pooled connections and application roles and if I could reliably identify the underlying sql connection it could help a lot.</p>
  
  <p>Here's some code that might illustrate the question</p>
  
  <pre><code>SqlConnection c = new SqlConnection(myConnString);
  
  c.Open();  // GetHashCode == "X"
  
  c.Close(); // returns connection to pool
  
  c.Open;  // GetHashCode() == "X" but possibly different pooled connection?
  </code></pre>
  
  <p>As I write this question it occurs to me that what I probably want is the SPID of the connection.  Sadly, SPID isn't available when the connection is dropped by SQL due to the bug I'm trying to resolve (so at the point I'm most interested in I can't run a command on that connection to obtain the SPID).</p>
  
  <p>Any other bright ideas? </p>