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”
    =”…” 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 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
    on optimizing two important SPs used by Profile

4 thoughts on “Things you must do for ASP.NET 2.0 Membership Provider before going live”

  1. Shouldn’t this be titled “Things you must do when using ASP.NET 2.0 Profiles before going live”?

  2. I didn't know why the profile wasn't saving 'til I found this page.

    Turning off automatic updates fixed the problem.


Leave a Reply