I was wondering if it is possible to change the sqlConnectionString used for SessionState in ASP.net based on the domain the application is running on?
scenario; We have 20 sites working from one application, all of which talk to different databases, depending on which domain (site) they are viewing.
When browsing www.domain1.com, the application accesses the database "db1". On the other hand, the site www.domain2.com is negotiating with the database "db2", etc., Thus, choosing the appropriate content, and also spreading the load on each database, and not using one main database to process all connections for sites.
The problem that arose is that for this setting we use the SqlServer mode for SessionState, so all users in all site sessions are stored in 1 aspstate database, now that sites become more busy / number of sites, this database grows to handle all session requests for all sites, and we start getting some timeout errors when connections to this database are bottlenecks.
We can separate the sites from our own application and configure different applications with the same code, but each application sets up different session databases in each Web.Config and, thus, the download is weakened. However, this task will be time consuming and lead to more effective management in the long run. SO .. I would like to know if it is possible to change the sqlConnectionString code used for a domain-based SessionState before creating a session object? Can we inherit from System.Web.HttpApplication and use the Application_AcquireRequestState event to create the necessary setting for the HttpSessionState object?
Hope this makes sense, and someone can give some pointers and prove to me that this is not a dream!
Cheers, Steve