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:
- 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:
-
< profile enabled =”true” > < providers > < clear /> < add name =”…” type =”System.Web.Profile.SqlProfileProvider”
connectionStringName
=”…” applicationName =”YourApplicationName” description =”…” /> providers > - 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” > - 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” > - See my previous
post on optimizing two important SPs used by Profile
Provider.
You’ve been kicked (a good thing) – Trackback from DotNetKicks.com
Shouldn’t this be titled “Things you must do when using ASP.NET 2.0 Profiles before going live”?
Real good post
I have posted on the application name here
http://www.vikramlakhotia.com/Membership_API_should_Have_Application_Name_property.aspx
I didn't know why the profile wasn't saving 'til I found this page.
Turning off automatic updates fixed the problem.
Thanks.