Fix for Login Error After DNN 7 Upgrade

Short Version

When upgrading from DNN 6.x to DNN 7.x, the installation wizard seems to miss an important setting in the web.config.  It also does not delete old DLLs from the /bin/ folder.  Because you are performing an upgrade rather than a clean installation, there are two versions of the AspNetMembershipProvider available, and the web.config may point to the wrong one.

Here is the fix.  Update your web.config to change the AspNetMembershipProvider section so that it uses the DotNetNuke.dll assembly instead of the DotNetNuke.Provider.AspNetProvider.dll assembly.

    <members defaultProvider="AspNetMembershipProvider">
      <providers>
        <clear />
        <add name="AspNetMembershipProvider" 
          type="DotNetNuke.Security.Membership.AspNetMembershipProvider, 
          DotNetNuke.Provider.AspNetProvider" 
          providerPath="~\Providers\MembershipProviders\AspNetMembershipProvider\" />
      </providers>
    </members>

After removing “.Provider.AspNetProvider” from the configuration, everything should work fine.

The Full Story

Yesterday I spent several hours debugging and fixing a DotNetNuke installation after upgrading from version 6.2.6 to 7.2.1.  The upgrade appeared to work without any errors.  However, when I tried to log in, I got an error.  I tried searching around for a resolution.  I found a number of similar complaints on the DNN forums but nobody had solved the problem.

Since I’m a software engineer, I decided to try to dig into the source code.  I found the underlying error message and figured out that there was a problem occurring inside the UserController.cs class file.  Whenever it would call MembershipProvider.Instance().UpdateUser(user) it would blow up with the error message, “System.ArgumentException: Parameter count does not match Parameter Value count.”  I determined that this was due to a mismatch of C# code sending the wrong parameters to a stored procedure (dbo.UpdateUser).

I looked through the source and found that the only membership provider instance was AspNetMembershipProvider.cs.  I tried setting breakpoints in that membership provider, but Visual Studio never reached them.  I tried adding logging but nothing was output.  I searched around Google some more, and here is the only workaround that I could find:  http://www.itfunk.com/2013/08/26/dot-net-nuke-a-critical-error-has-occurred-an-unexpected-error-has-occurred/  That blogger suggested changing the stored procedure definition to fix the mismatch.  But I was looking right at the database, and the C# code matched the stored procedure parameters.

Finally, a light bulb came on:  The new AspNetMembershipProvider code was not being reached at all.  I pulled up the source code for DNN 6 and compared it with DNN 7, and I found that the membership provider had been moved into the “main” DotNetNuke.dll assembly.  Previously it was in its own assembly (DotNetNuke.Provider.AspNetProvider.dll).  So there were two versions of the membership provider in the /bin/ folder, and the web.config was still pointing at the old DNN 6 version.  I updated my web.config to point to the right assembly and VOILA!  Problem solved.

In summary, upgraded DNN 7 installations may still be referencing the old DNN 6 authentication provider.  This produces an error when the authentication provider calls the UpdateUser stored procedure during login.  The DNN 7 version of the stored procedure has more parameters than DNN 6 did, causing the “parameter count” error.  A simple web.config change (shown above) updates DNN to use the correct AspNetMembershipProvider.

Maybe I can send a bill for my consulting work to DNN Corp.  🙂

Advertisements

Free DotNetNuke Modules: Part 1

I’ve been a fan of DotNetNuke for several years, but I haven’t had many opportunities to use it in the real world until recently. As I run into different business needs, I often face the eternal question about DotNetNuke modules: “Should I built it or buy it?” True, there are a lot of great modules available for sale, but there are also a surprising number of free modules available. I intend to catalog some of my favorites through this series.

When looking for a DotNetNuke module, most people start at SnowCovered.com which is the official DotNetNuke Marketplace. This is the most common place to find modules available for purchase. However, it occurred to me that if you go to their Modules category and sort by price, there are a number of modules listed for $0.00. If you click this link, you’ll see that the first 3-4 pages of results include dozens of free modules.

Another popular place to look is the DotNetNuke Forge which has a mix of free open-source modules and commercial modules for sale. It also provides downloads for official DotNetNuke projects that are not included in the main DNN installation process. On the main Forge screen, click the “Filter By” drop-down and select “Core DotNetNuke Projects” then click “Go” to search. You can also find Core Project updates on the New Releases page (note: you may need to register or log in to see the module downloads).

There are quite a number of open-source DotNetNuke projects available on CodePlex. Beware that these projects are in various stages of development, so unless you’re a developer willing to do some of your own quality assurance, I would stick to popular projects that have an active development community. If a project hasn’t been updated in a year, you should probably find an alternative.

In addition to these well-known freebie sources, there are quite a number of free modules and upgrades available from individual developers and companies. Following are a handful of my current favorites:

  • Advanced Control Panel – by Oliver Hine. This is a replacement for the standard DotNetNuke control panel. It is a great step forward in ease of use for non-technical site administrators. The author also published several other free modules including a photo gallery, weather, file upload, Google Analytics enhanced tracking, and an enhanced permissions/workflow for content editing.
  • Friendly URL Provider – by iFinity. While DotNetNuke did incorporate “friendly URLs” some time ago, this free module produces much shorter and cleaner URLs than the standard DNN provider. It even supports “extensionless” URLs and 301 redirects for non-friendly URLs. The author also sells the iFinity URL Master module for greater fine-tuning.
  • NB_Store – on CodePlex. In my experience, the official DotNetNuke Store module has been clunky and flaky (and it caused my portal to be painfully slow until I manually deleted the module). NB_Store is a nice open-source alternative.
  • DNN Menu – by DNN Garden. This is a search-engine friendly alternative to the default SolPartMenu and DNNMenu. There are commercial alternatives (like Snapsis Menu) but free is hard to beat.
  • Amazon S3 Folders Provider – by Brandon Haynes. This is a file storage/retrieval provider using Amazon S3 to store files remotely. It adds remote storage to the regular file management of DotNetNuke and essentially allows websites to have unlimited file storage.
  • DNN SiteMap Module – by Derek Trauger. This module displays a real-time HTML site map which is useful both for end users and search engines to find relevant content.

That’s nowhere near comprehensive, but it’s a good start. I’ll add more articles as I discover more noteworthy freebie modules. Please use the comments area to suggest your own favorite free DotNetNuke modules (no commercial advertisements, please). Happy coding!

Kick it on DotNetKicks.com [Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]