title: How to Get the ConnectionString that the Membership Provider is using?
body: <p>... and not by reading it from the config file! Nor inferring it from anyplace other than be reading exactly what the Membership Provider is itself using. Call me paranoid. </p>
  
  <p>The first data access in my application is an access to the membership provider. The vast majority of connectivity issues have been where the application is deployed to staging or production with a connection string from development, so I'd like to change this:</p>
  
  <pre><code>MembershipUser me = Membership.GetUser();
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>MembershipUser me;
  
  try
  {
      me = Membership.GetUser();
  }
  
  catch ( SqlException E )
  {
      Response.Write( "SQL Error " + E.Message + ".&lt;br /&gt;" );
      Response.Write( "Connection String: " + Membership.Provider.WHAT? + "&lt;br /&gt;" );
  }
  </code></pre>
  
  <p>Seems so obvious, but every reference I find instructs me to use the <code>ConfigurationManager</code>, which is what I specifically <i>don't</i> want to do. Although I concede that such may be my only option, and a satisfactory one at that.</p>
  
  <p>I'm perfectly willing to accept the possibility that my question is on par with this:</p>
  
  <pre><code>int i;
  
  try
  {
      i = 42;
  }
  
  catch ( Exception e )
  {
      Response.Write( "Error assigning literal to integer." );    
  }
  </code></pre>
  
  <p>If this is the case, please comment accordingly.</p>