Google
 
Web xtremedotnet.blogdrive.com
Musings of a .Net Developer





Rohan Thomas' Weblog




Direct contact : xtreme.net(at)Gmail.com

Affliations
Singapore Professional .Net Usergroup



Moderator for .Net Message Boards at :
Programmers Heaven - Where programmers go!






"No problem can sustain the assault of sustained thinking." - Voltaire


Listed on BlogShares
   

<< May 2005 >>
Sun Mon Tue Wed Thu Fri Sat
01 02 03 04 05 06 07
08 09 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31




Promote your blog for free.



If you want to be updated on this weblog Enter your email here:



rss feed


Wednesday, May 11, 2005
ASP.NET 2.0 Profiles in a Load-Balanced (Web-Farm) Scenario

Then came web-farming issue just when life started to seem smooth sailing :)

I am planning to utilize ASP.NET 2.0 profiles in my project and everything was good, then came the scenario whereby the UI layer in running on a Web-Farm! Hmmm...

Profiles utilize a local database to keep the info and in a Web-Farm it would be kinda impossible to perform that feat! Good thing Profiles are configurable!

Not only ASP.NET profiles but membership, roles, and web-part personalization also support web-farms!

So what we do is to configure the profiles to read from a central db (in this case, the db that the web farm machines are pointing to). When u modify the state of the profile object, the modifications are saved between visits to the site. So if the request is directed to a different server within the same session (in web-farm scenario), the profile state will be intact, since its stored and accessed out of central db.

So in a web-farm scenario, this is what you should do :

1)Point each machine on the web farm to the same database server to store the profiles. You can set this by changing the connection string on the provider configuration.
   - Since Profiles are API and Schema over database access, there shouldn't be a lot of considerations while shifting the db target from local to the web-farm central db.

2)Now to make profiles use your application's db instead of its own, use the "aspnet_regsql" tool (Window\Microsoft.NET\Framework\[version]) which will let you add the tables utilised by profiles to your own db. Run it without any command line parameters to get the windows wizard that configures all this for you (you can also point to the db used by ur app with this wizard). [OR, run it with the -? option to see all the command line parameter, yea, i know u already know this ;)]

3)So now, the database tables that profiles are using is in ur own application's db (the tables utilized by Profiles, Membership, etc will have a ASP.NET prefix), now go ahead and create relationships between these tables and your own application's tables!

Remember, Adding fields to the tables utilised by profiles is not recomended, unless you write your own provider that can handle these fields!

Cheers!


Posted at Wednesday, May 11, 2005 by XtremeDotNet

 

Leave a Comment:

Name


Homepage (optional)


Comments




Previous Entry Home Next Entry