Things you must do for ASP.NET 2.0 Membership Provider before going live

Some tweakings you should do on your web.config if you are using ASP.NET 2.0 Membership Provider before you go live on your production server:

  1. Add "applicationname" attribute in Profile Provider. IF you do not add a specific name here, Profile provider will use a GUID. So, on your local machine you will have one GUID and on production server you will have another GUID. If you copy your local DB to production server, you won't be able to reuse the records available in your local DB and ASP.NET will create a new application on production. Here's where you need to add it:
  1. < profile enabled ="true" > < providers > < clear /> < add name ="..." type ="System.Web.Profile.SqlProfileProvider" connectionStringName ="..." applicationName ="YourApplicationName" description ="..." /> </ providers >
  2. Profile provider will automatically save the profile whenever a page request completes. So, this might result in unnecessary UPDATE on your DB which has significant performance penalty. So, turn off automatic save and do it explicitly from your code using Profile.Save();
    < profile enabled ="true" automaticSaveEnabled ="false" >
  3. Role Manager always queries database in order to get the user roles. This has significant performance penalty. You can avoid this by letting Role Manager cache role information on cookie. But this will work for users who do not have a lot of roles assigned to them which exceeds the 2 KB limit of Cookie. But it's not a common scenario. So, you can safely store role info on cookie and save one DB rountrip on every request to .aspx and .asmx.
    < roleManager enabled ="true" cacheRolesInCookie ="true" >
  4. See my previous post on optimizing two important SPs used by Profile Provider.
Published Sun, Aug 27 2006 10:43 by omar
Filed under: