how can I able to change my initial catalog before and after authentication?

my logic is to check the if the project exist in a global database
if it does, then change the connectionstring to that project database to validate the users account.

the reason is that I have a multiple project databases with each has users table.

TIA

I'm using c# MVC4 and Entity Framework Database first.