Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Attention - Delete Portal bug - corrupts user accounts which are members of multiple portalsAttention - Delete Portal bug - corrupts user accounts which are members of multiple portals
Previous
 
Next
New Post
11/7/2006 5:11 PM
 

This was noted in DNN 4.3.5. It has been logged in Gemini as DNNP-4463

Suppose User1 is a Registered User on Portals A and B. If Portal B is deleted, this error appears in page after attempting login to Portal A:

Object Reference not set to instance of an object.

User1 is unable to use Portal A from here on. I have tracked the source of the error down to a missing record in aspnet_Membership. If the record is recreated, User1 is able to access Portal A as before.

Before the portal is deleted, User1 has records in the following tables:

  • User (1 record)
  • aspnet_Users (1 record)
  • UserPortals (1 record for Portal A,  1 record for Portal B)
  • aspnet_Membership (1 record for membership of 'DotNetNuke' application)
  • UserRoles (1 record for every role a member of in Portals A & B)

If Portal B is deleted, User1 now has the folowing records:

  • User (1 record)
  • aspnet_Users (1 record)
  • UserPortals (1 record for Portal A)
  • No records in aspnet_Membership *
  • UserRoles (1 record for every role a member of in Portal A)
  • * If the original record is recreated, access is restored.

    This problem seems to affect all users who have membership of Portal A as well as Portal B. Interestingly it does not affect the Host user, whose aspnet_Membership record does not get deleted.

     
    New Post
    11/13/2006 5:18 PM
     
    Hi Laurence,

    I appear to be stuffed here.  How did you recreate the aspnet_Membership record.  I've recreated portal B but I don't seem able to create a user with the same username that I had before? I'm getting the 'A User Already Exists For the Username Specified. Please Register Again Using A Different Username.' message :(

    Cheers

    Barry
     
    New Post
    11/14/2006 7:05 AM
     

    You are probably stuffed. You are getting that message because most of the user account exists, there is just 1 piece missing - the aspnet_Membership record. The trouble is that the aspnet_Membership record contains the user's password in encrypted format (amongst other things), so its not easy to recreate.

    The only reason I was able to recreate the record was that my DNN was version 4.3.5 upgraded from an early 3.x version. In early 3.x versions the aspnet_Membership table contained multiple records for each user, and many of these had been "left behind". In other words the aspnet_Membership record that DNN 4.3.5 needed was gone but there were many other almost identical ones still in the table that I could base my replacement record on.

    Run this SQL query to identify your corrupted user account(s) and also see if it has any old aspnet_Membership records that could be used to recreate the needed aspnet_Membership record:

    select u.*, am2.*
    from users u
    join aspnet_Users au on u.username = au.username
    cross join aspnet_Applications aa
    left join aspnet_Membership am on au.userid = am.userid and aa.applicationid = am.applicationid
    left join aspnet_Membership am2 on au.userid = am2.userid and aa.applicationid <> am2.applicationid
    where aa.applicationname = 'DotNetNuke'
    and am.userid is null

    The columns UserID-UpdatePassword should identify the corrupted user account. If there is data under the next columns (ApplicationID, UserID ......) then you have an old aspnet_Membership record. If so, try running this to use it to recreate the missing one:

    insert aspnet_Membership (ApplicationId,UserId,Password,PasswordFormat,PasswordSalt,MobilePIN,Email,LoweredEmail,PasswordQuestion,PasswordAnswer,IsApproved,IsLockedOut,CreateDate,LastLoginDate,LastPasswordChangedDate,LastLockoutDate,FailedPasswordAttemptCount,FailedPasswordAttemptWindowStart,FailedPasswordAnswerAttemptCount,FailedPasswordAnswerAttemptWindowStart,Comment)
    select distinct aa.ApplicationId,au.UserId,am2.Password,am2.PasswordFormat,am2.PasswordSalt,am2.MobilePIN,u.Email,lower(u.Email) as LoweredEmail,am2.PasswordQuestion,am2.PasswordAnswer,1 as IsApproved,0 as IsLockedOut,am2.CreateDate,am2.LastLoginDate,am2.LastPasswordChangedDate,am2.LastLockoutDate,am2.FailedPasswordAttemptCount,am2.FailedPasswordAttemptWindowStart,am2.FailedPasswordAnswerAttemptCount,am2.FailedPasswordAnswerAttemptWindowStart,am2.Comment
    from users u
    join aspnet_Users au on u.username = au.username
    cross join aspnet_Applications aa
    left join aspnet_Membership am on au.userid = am.userid and aa.applicationid = am.applicationid
    join aspnet_Membership am2 on au.userid = am2.userid and aa.applicationid <> am2.applicationid
    where aa.applicationname = 'DotNetNuke'
    and am.userid is null

    Note that this may restore the account with a password that it had in the past but not its most recent password.

     
    New Post
    11/14/2006 11:21 AM
     
    Hi Laurence, further investigation shows that I *do* have an aspnet_Membership record for that ID, so it appears that the problem that I have, may not be the that one you experienced.

    Thanks for trying to help.
     
    New Post
    11/14/2006 11:56 AM
     
    OK just check it is has an ApplicationID matching the ApplicationID of the record in aspnet_Applications where ApplicationName = 'DotNetNuke'. If it has an ApplicationID matching a different application in aspnet_Applications that is a hangover from an old version of DNN, and is not used in DNN 4.3.5
     
    Previous
     
    Next
    HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Attention - Delete Portal bug - corrupts user accounts which are members of multiple portalsAttention - Delete Portal bug - corrupts user accounts which are members of multiple portals


    These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

    For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

    1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
    2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
    3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
    4. No Flaming or Trolling.
    5. No Profanity, Racism, or Prejudice.
    6. Site Moderators have the final word on approving / removing a thread or post or comment.
    7. English language posting only, please.
    What is Liquid Content?
    Find Out
    What is Liquid Content?
    Find Out
    What is Liquid Content?
    Find Out