title: Changing Membership.ApplicationName in code - thread safety
body: <p>On the <a href="http://msdn.microsoft.com/en-us/library/system.web.security.membership.applicationname.aspx" rel="nofollow">MSDN page</a> for the <code>Membership.ApplicationName</code> property (which applies to an asp.net membership provider), it warns that although one can change <code>Membership.ApplicationName</code> in code, 'The ApplicationName property is not thread safe for multiple writes, and changing the ApplicationName property value can result in unexpected behavior for multiple users of an application.'  They therefore recommend avoiding using it for a 'web application'.</p>
  
  <p>This is because the default <code>SqlMembershipProvider</code> is written as a singleton.  But here's my question: is it OK if all the threads in my application process are going to set <code>Membership.ApplicationName</code> to <strong>the same thing</strong>?</p>
  
  <p>I'm thinking of having multiple applications on my IIS box, each with their own separate application pool.  I want to point them to the same location, but based on the hostname, set the application provider to different things.  Wouldn't this actually be OK?  It might not be a thread-safe operation, but doesn't each application pool have its own process and therefore its own instance of <code>SqlMembershipProvider</code>?  So, every thread that tried to set <code>Membership.ApplicationName</code> for a given <code>SqlMembershipProvider</code> instance would be trying to set it to the same thing (the provider that is appropriate for that hostname).  Or am I missing something?</p>
  
  <p>I guess the main question is, do ALL asp.net applications share one <code>SqlMembershipProvider</code>, or is a separate one created for each application pool process?</p>