DotNetNuke -- IndexOutOfRangeException: DisplayName

By Michael Flanakin @ 1:45 PM :: 2960 Views :: DotNetNuke :: Digg it!

I recently had to upgrade one of my clients from 3.2.2 to the latest release and ran into a bit of a snag. We started with 3.3.1 and decided to use 3.3.2 in hopes that the problem would be fixed. Unfortunately, it wasn't. Here's what I found...

Symptoms

After upgrading DNN source to 3.3.0-2 or 4.3.0-2 and browsing to the website, you receive an error message that is similar to the following:

System.IndexOutOfRangeException: DisplayName

Cause

When accessing the website, even during an upgrade, the website is authenticating the request. During the authentication process, the membership provider doesn't take into consideration that the SQL scripts haven't been applied. Since the pre-3.3 scripts did not obtain the DisplayName column, the assembly raises the aforementioned exception.

Resolution

You may not like this one...

  1. Download the source version of the release
  2. Open the ...\Providers\MembershipProviders\AspNetMembershipProvider\AspNetMembershipProvider.vb file
  3. In 3.3.2, Starting on line 301, change the entire if block to the following...

    I'm assuming the code is the same in 4.3.2. For those interested in the actual changes, I simply encapsulated teh following properties in try blocks: DisplayName, AffiliateID, Email, UpdatePassword, and IsApproved
  4. Compile and continue as if the problem never happened

I will work on getting have a compiled assembly (3.3.2) available for download. If I get a chance, I'll work on getting 4.3.2 up, but anyone should be able to use this assembly for DNN 4.3.2, also. Let me know if you have any problems with it.

More Information

  • Applies to: DotNetNuke 3.3.0 - 3.3.2, 4.3.0 - 4.3.2

Ratings