Last post Nov 03, 2014 01:30 AM by Michelle Ge - MSFT
Oct 31, 2014 02:46 AM|KtrMtm|LINK
after spending 3 days reading everything i found on asp.net identity 2.0 and OWIN
I'm here to ask for help to this issue.
I'm writing a web application that need to be installed on 10 different servers,
each server located physically in different machine (the intranet is worldwide)
http://webserver-001/ ,http://webserver-002/ , ... http://webserver-010/ , they all inside our intranet network.
on each server we have IIS were the application will be deploy to and also has SQL Server database that holds the User Store and all Tables for the application.
on each server we have sql server with one database on it, [sqlserver-a], [sqlserver-b], .... [sqlserver-j],
So, we have 10 different web addresses, one for each server, and the user can use any of this addresses to access the application,
When user Login, we ask him, in addition to his Username+Password , also to select to which [sqlserver-?] he wants to connect to
the problem is that when we are using asp.net identity 2.0 and Owin, the ApplicationDbContext : IdentityDbContext<ApplicationUser>
has in it's constructor the connection string that exists in the Web.Config
: base("TheConnectionStringFromWebConfig", throwIfV1Schema: false)
// dont create tables, all database tables and stored procedures is managed independently
using the OWIN we get on each Request (please fix me if i'm wrong) an instance of ApplicationDbContext
which get its connection string from the Web.Config
But we need to set it in Runtime only after the user LOGIN ...
Can someone help me with this architecture ?
how to use multiple connection strings and how on each request to get the User preferred connection string that he selects when he was login ?
Please note, that each sqlserver has it's own AspNetIdentity Tables , so if user choose to try Login to sqlserver that he not previously registered as a user he will be denied.
User need to registered as new user FOR-EACH sqlserver he wants to login to later.
Please consider also the problem i need to solve regarding the "Remember Me" scenario when the user already loged in to some sqlserver
I manage to store in the Application Cookie also the User Claim that i add to the User when he was logged in .
Please let me know how you can solve this .
Many Thanks ,
Nov 03, 2014 01:30 AM|Michelle Ge - MSFT|LINK
So far as I known, you can create multiple connectionstring in web.config file. As one user login, we can decide which connectionstring to use by the server which the server selected.
There is a document about using multiple connectionstring, please refer to the link below:
Hope it's useful for you.