Thanx Mr.Biswas. I did fix the problem with session object. But I will keep in my mind your suggesiton and I will use it in the other module. Thank you Prasad
vempatiprasad
Posts
-
Retrieving the connection string from web.confi -
Retrieving the connection string from web.confiThanx Hussain. As you said, i used Session variable to get the connectionstring.
-
Retrieving the connection string from web.confiI need help!! I am working on a .NET project using C# with SQLServer as database. I have 10users who access the web site with different user id and password. Each user is having seperate database. Based on each user id, i have to retrieve different connection string from web.config. The same connection string will be used in each page, i access the database. My question is.. how to retrieve the userid in each page? so that I can use it to retrieve the connection string in each page rightnow I am retrieving the userid in login page and form authenticating with database. public void LoginUser(Object s, EventArgs e) { bool blnAuthenticate = Authenticate(username.Text, password.Text); if (username.Text == "AB....") { connString = WebConfigurationManager.ConnectionStrings["ABConnectionInfo"].ToString(); } else if (username.Text == "CD....") { connString = WebConfigurationManager.ConnectionStrings["CDConnectionInfo"].ToString(); } else if (username.Text == "EF....") { connString = WebConfigurationManager.ConnectionStrings["EFConnectionInfo"].ToString(); } else if (username.Text == "GH..") { connString = WebConfigurationManager.ConnectionStrings["GHConnectionInfo"].ToString(); } else if (username.Text == "IJ....") { connString = WebConfigurationManager.ConnectionStrings["IJConnectionInfo"].ToString(); } if (blnAuthenticate) { FormsAuthentication.RedirectFromLoginPage(username.Text, false); } else { lblError.Text = "Your login was invalid. Please try again."; } } bool Authenticate(string strUsername, string strPassword) { ............ } I appreciate help from anybody..Thank you