You can use forms authentication to create a login system. The login actually have to do anything, but you could probably link it up to the database server's users table to verify that they are a valid SQL user. For this query you'll need some admin role user for the connection string.
Once the user is logged in, you can store the username and password in session so that you can retrieve it on all the pages that are making queries.
You could store the connection string in the web config like this:
"user id={0};password={1};Data Source=<server>;Initial Catalog=<database>;"
Then whenever you use the connection string, just run it thru String.Format:
strConnString = ConfigurationSettings.AppSettings("ConnString")
objConn.ConnectionSring = String.Format(strConnString, Session("uid"), Session("pwd"))
This way you can keep the connection details centralized but have the user part dynamic.
|