Change Database Source Depending On Login Credentials
I'm a new developer and I'm working on a project that utilizes the SalesForce REST API. A portion of my .Net project involves updating the web.config and the database depending on the login credentials.
For example, client 1 logins in, the are updated with the correct Consumer Key and Client Secret. This client has access to Database1.
Client 2 logs in. are updated appropriately. Now, the Database1 is switched out with Database2, programmatically.
Is there a way to programmatically change the database source depending on login?
Quick edit to my post. Client1 and Client2, in this instance, are two separate companies, that should not have access to each other's databases. I want to be able to utilize the same application for both clients, but update the web.config and the database used, depending on which company logs in.
If you are using L2S or EF, you can create a class within your application that inherits your L2S/EF context class, then make the derived class's constructor do the work of figuring out what connection string to use based on log in and initialize itself. You can then use that derived class as a data source as needed.
Basically, it sounds like you may have a situation where you don't want to be updating the web.config every time you add a new client/database. You'll want to store a template for the connection string in web.config, but not the strings themselves.
- → How to Fire Resize event after all images resize
- → URL routing requires /Home/Page?page=1 instead of /Home/Page/1
- → Getting right encoding from HTTPContext
- → How to create a site map using DNN and C#
- → I want integrate shopify into my mvc 4 c# application
- → Bootstrap Nav Collapse via Data Attributes Not Working
- → Shopify api updating variants returned error
- → ASP.NET C# SEO for each product on detail page on my ECOMMERCE site
- → SEO Meta Tags From Behind Code - C#
- → How to implement search with two terms for a collection?