Skip to content
Donner's Daily Dose of Drama
Donner's Daily Dose of Drama
  • The Good
    • Blogging
    • Consumer Protection
    • Environment
    • Ethics
    • Geek’s Home
    • Lisa Lanett
    • Medfield
    • Music
    • Parenting and Technology
    • Travel
    • wow
  • The Bad
    • Business
    • Ebay
    • Investment
    • Job search
    • Personal Finance
    • Politics
  • The Ugly
    • Information Technology
      • Business Intelligence
      • Content Management
      • Free Software
      • I18N and L10N
      • Java
      • Open Source
      • Mobile Devices
      • Open Source Business Intelligence
      • OSBI
      • SDA
      • Security
      • Smartphone
      • Software Best Practices
      • Software Engineering
      • SQL Server
      • Streaming Media
      • Web
    • Austria
    • Fiction
    • Hardware
    • iPod
    • Miscellaneous
    • Uncategorized
    • Video
    • Weekend Warrior
Donner's Daily Dose of Drama

Forms Authentication – Custom Membership Provider Gotchas

Christian Donner, September 17, 2009September 18, 2009

Forms Authentication is a very useful feature of the Asp.net framework. Unfortunately, in its default configuration, the requirements for password length and strength, security question, and some of the other options are too strict for most low-end web applications and Intranets.
So, if you are new to this subject and try to find information on the web for how to customize Forms Authentication, you will most certainly come across this very useful post on Scott Guthrie’s blog.Scott explains the importance of the applicationName parameter for custom Membership providers. He explains why the applicationName should be set to “/”, to match the default setting for the application root node. However, if you only define a custom Membership provider in your web.config, then move the database or change the web root, things will fall apart because the applicationName for the default Role provider will be different, resulting in 2 entries in the aspnet_Applications table. Once that happens, and new users and roles are added, there will be duplication going on in the database for each new entry (because role queries and membership queries will use a different application).

The answer is: If you use customer providers, you must always create both, a membership and a role provider, and use the same application name in the web.config:

<roleManager defaultProvider="MyRoleProvider" enabled="true">
 <providers>
  <clear/>
  <add connectionStringName="LocalSqlServer"
       applicationName="/"
       type="System.Web.Security.SqlRoleProvider"
       name="MyRoleProvider"/>
 </providers>
</roleManager>
<membership defaultProvider="MyMembershipProvider">
 <providers>
  <clear/>
  <add connectionStringName="LocalSqlServer"
       applicationName="/"
       minRequiredPasswordLength="5"
       minRequiredNonalphanumericCharacters="0"
       requiresQuestionAndAnswer="false"
       requiresUniqueEmail="false"
       name="MyMembershipProvider"
       type="System.Web.Security.SqlMembershipProvider" />
 </providers>
</membership>

Again, if you do not define both providers, the result is potentially the same as when you use different application names for the membership and the role provider – much confusion in the database.

I tried to comment on Scott’s post, but was unable to register this morning. Microsoft has built an impressive single-signon infrastructure on their community sites that use the Windows Live id, but this does not help when you a served a broken image link for the Captcha :-).

Related Posts:

  • Enphase Envoy Local Access
  • The Voip.ms SMS Integration for Home Assistant
  • SUTAB Scam?
  • OpenVPN
  • Amazon threatens customer of 26 years

Software Engineering

Post navigation

Previous post
Next post

Leave a Reply

Your email address will not be published. Required fields are marked *

Pages

  • About
  • Awards
    • TechnoLawyer
  • Contact Christian Donner
  • Project Portfolio
  • Publications
  • Speaking Engagements

Recent Comments

  • Christian Donner on Sealing a leaky cast-iron fireplace chimney damper
  • Eric on Sealing a leaky cast-iron fireplace chimney damper
  • Christian Donner on Contact Christian Donner
  • Max on Contact Christian Donner
  • Christian Donner on Contact Christian Donner

Tags

AHCI Amazon Android ASP.Net AT&T Droid Drupal email Error failure featured firmware Garmin Godaddy Google honda Internet Explorer 8 iPhone Lenovo Lisa Lanett Modules NAS Nexus One Paypal Performance Privacy QNAP raid RS-407 sauna Security spam SQL SR3600 Synology T-Mobile T430s transmission tylö Verizon Virus VMWare Windows 7 windows 8.1 Windows Mobile
  • About
  • Awards
    • TechnoLawyer
  • Contact Christian Donner
  • Project Portfolio
  • Publications
  • Speaking Engagements
©2025 Donner's Daily Dose of Drama | WordPress Theme by SuperbThemes
Donner's Daily Dose of Drama
Donner's Daily Dose of Drama
  • The Good
    • Blogging
    • Consumer Protection
    • Environment
    • Ethics
    • Geek’s Home
    • Lisa Lanett
    • Medfield
    • Music
    • Parenting and Technology
    • Travel
    • wow
  • The Bad
    • Business
    • Ebay
    • Investment
    • Job search
    • Personal Finance
    • Politics
  • The Ugly
    • Information Technology
      • Business Intelligence
      • Content Management
      • Free Software
      • I18N and L10N
      • Java
      • Open Source
      • Mobile Devices
      • Open Source Business Intelligence
      • OSBI
      • SDA
      • Security
      • Smartphone
      • Software Best Practices
      • Software Engineering
      • SQL Server
      • Streaming Media
      • Web
    • Austria
    • Fiction
    • Hardware
    • iPod
    • Miscellaneous
    • Uncategorized
    • Video
    • Weekend Warrior