0

I have a MVC site that connects to some databases to get some views of data.

In this case, is the user who provides the connection string(server,db_name,password) at login, Then I have to pass that connections to the DbContext constructor to perform db operations.

This connections can change in the time so, I can´t set it "fixed" in the WebConfig connection strings section.

Where is the best way to store that connections while the user is loged in?

3
  • 1
    Is it considered acceptable to require the user to type in the connection string again every time they log in?
    – Brian
    Oct 30, 2015 at 16:56
  • Store it in the Session object if you just want it to live as long as the user session is alive Oct 30, 2015 at 17:24
  • You could extend the applicationUser class and add store them there. You could then retrieve them when the user logs in.
    – BillRuhl
    Oct 30, 2015 at 18:24

1 Answer 1

0

EDIT:

I would save it to a session as @Yacoub suggested.

2
  • My question is more about where to keep the username/password stored to use them every time I call the DBContext constructor?. Oct 30, 2015 at 17:51
  • Sorry, I didn't get it at first. Anyway, I just changed the answer.
    – Lance
    Oct 30, 2015 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.