Search
Thursday, October 23, 2014 ..:: Home ::.. Register  Login
   Calendar  
     
  
   Search  
     
  
   Blogroll  
     
  
   Disclosure  
All blog entries are the opinions of the author and do not necessarily reflect the opinions of their employer. All the code presented is for explanation and demonstration purposes only. Any damages incurred to your site and/or data are not the responsibility of the author. Every effort is taken to ensure the code properly compiles, however sometimes there are some hiccups and you might be required to do your own debugging.
     
  
   TechTidBits (Blog)  

Are you trying to reset a password in DNN?

Jan 27

Written by:
Thursday, January 27, 2011 11:09 PM  RssIcon

DNNAre you trying to reset your admin or host password in DNN?  I think I can help you out!

DNNI'm working on a community user group DNN website and I did something screwy.  I mucked up the host and admin accounts!  DOH!  Yup, I mean I REALLY screwed them up, so much that I couldn't log in with neither of them!  DOH! 

FrustratedYou know that feeling eh?  You look at the Users and aspnet_membership tables and see nothing in return?  (Palm meet forehead, SMACK! DOH!)  Oh the ache in the PIT of your stomach eh?

Thankfully I DO have SQL Server Management Studio access to the DB!  PHEW!  But when I google for solutions I get things like this, which JUST WEREN'T working for me!

create procedure uap_ResetPassword
  @UserName NVarChar(255),
  @NewPassword NVarChar(255)
as
begin
	Declare @PasswordSalt NVarChar(128)
	Declare @Application NVarChar(255)

	Set @Application = (SELECT [ApplicationID] FROM aspnet_Users WHERE UserName=@UserName)
	Set @PasswordSalt = (SELECT PasswordSalt FROM aspnet_Membership WHERE UserID IN (SELECT UserID FROM aspnet_Users WHERE UserName=@UserName))

	Exec dbo.aspnet_Membership_ResetPassword @Application, @UserName, @NewPassword, 10, 10, @PasswordSalt, -5
end

I did this but when I tried to log in with the host or admin accounts, STILL NO DICE!  DOH!  OH man, pit in stomach feeling getting worse!  DOH!

But then I came across these two sql scripts which DID work for me.  They have ONE key assumption, you have to know the password to at least ONE account.  Ok, that's not so bad, why?  Cause you can always Register a new user and steal THAT password and salt values.

First sql helps get you the fields you need to cut'n'paste into the second script.  Just change the 'admin' in the username line to the username of the password you DO know for sure!

SELECT password, passwordformat, passwordsalt
FROM aspnet_membership am
    INNER JOIN aspnet_users au
        ON (au.userid = am.userid)
    INNER JOIN aspnet_applications aa
        ON (au.applicationId = aa.applicationid)
WHERE au.username = 'admin'
    AND aa.applicationname = 'DotNetNuke'

Next, cut'n'paste the

DECLARE @changeDate datetime
set @changeDate = getdate()

exec aspnet_Membership_setPassword 
	'DotNetNuke', 
         'YourUsername_Goes_Here', 
         'EncryptedPasswordYouKnow_DM1tZvBjM+FeG42XuJnMuin3jqFOtMjS83RN6d7dFbQ==',
         'SaltYouKnowFromAbove_4e5Yu/JFXVdRmlA==',
         @changeDate, 2

Ok, after doing this magic and slight of hand, I was BACK IN BUSINESS!   COOL!

Now that I can administrate the website again, it's time to grab a coffee and get coding!

 

Resources:

AQUEST Hosting: Reset Password for ASP.Net 2.0 Membership (working solutio for me)

Ottawa IT Community user groups umbrella website

devprise.com: How to reset a DNN password at the Database (didn't work for me, not sure why?) 

Tags:
Categories:
Location: Blogs Parent Separator TechTidBits

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 
     
  
Copyright 1999-2012 by PCHenry.com   Terms Of Use  Privacy Statement