473,385 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem with ResetPassword - NullReferenceException

I am writing code to reset a password, even if the current password is not
known. (This is for a site admin.) When I get to my ResetPassword line I
keep getting...

System.NullReferenceException: Object reference not set to an instance of an
object. at CoreLab.Common.Web.Providers.DbMembershipProvider. a(String A_0,
String A_1, Boolean A_2) at
CoreLab.Common.Web.Providers.DbMembershipProvider. ResetPassword(String
username, String answer) at
System.Web.Security.MembershipUser.ResetPassword(S tring passwordAnswer) at
System.Web.Security.MembershipUser.ResetPassword() at
admin_manageusers.cmdChgPwd_Click(Object sender, EventArgs e) in
F:\work-related\websites\1\admin\manageusers.aspx.vb:line 102

Any ideas why?

Here's the code...

Protected Sub cmdChgPwd_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cmdChgPwd.Click
Dim u As MembershipUser
Dim un As String =
GridView1.DataKeys(GridView1.SelectedIndex).Values ("Username")

u = Membership.GetUser(un)

If u Is Nothing Then
lblStatus2.Text = "Username " & un & " not found!"
lblStatus2.ForeColor = Drawing.Color.Red
Return
End If

Dim autopassword As String = ""

Try
autopassword = u.ResetPassword()
Catch ex As Exception
lblStatus2.ForeColor = Drawing.Color.Red
lblStatus2.Text = "Error: " & ex.ToString
Return
End Try

Try
u.ChangePassword(autopassword, Me.txtNewPassword.Text)
Catch ex As Exception
lblStatus2.ForeColor = Drawing.Color.Red
lblStatus2.Text = "Error: " & ex.ToString
Return
End Try

lblStatus2.ForeColor = Drawing.Color.Green
lblStatus2.Text = "Password changed!"
End Sub
Oct 7 '08 #1
1 1273
The issue was because of the membership provider, requiring Q&A.

Here's the solution...
http://peterkellner.net/2007/02/15/resetpasswordaspnet/
http://forums.asp.net/p/965209/1206792.aspx#1206792

Hope this helps someone!
Oct 7 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Terrence | last post by:
I am doing some of the C# walkthroughs to transition from VB to C#. When I try to execute static void Main() { Aplication.Run(new Form1()) } I raise a 'System.NullReferenceException" in...
0
by: Deutsche Dogge | last post by:
Hi. I'M having a weird problem with addign menuitems to a menu dynamically on the popup event of the menuitem containing the container of the menuitems i wanna add (tools -> external -> {list of...
2
by: Enrico Pangan | last post by:
I'm trying to call some functions in a C++ Dll, "Library.dll" from C#. Some functions work but some return the NullReferenceException. I have here the source code for the C++ version and for the...
3
by: pnp | last post by:
Hi all, I have developed an app in C# and I have used some of the Infragistics components in it. The problem is that while one is playing with the windows within the mdi container exceptions occur...
1
by: leslie_tighe | last post by:
Hello, I have webservice created with Axis 1.2.1 and that I am trying to consuming in .NET (VB) using the Microsoft provided tools. While I am able to consume methods on the service that return...
4
by: leslie_tighe | last post by:
Hello, I have a webservice running on a J2EE server created with Axis 1.2.. I have a client that I am building in .net that needs to consume this webserivce and am having a bit of trouble. I have...
0
by: leslie_tighe | last post by:
Hello, I have a web service that is running in a java server using axis that I want to use from .net. In VS.net 2003 I setup a project with a web reference. Using generated code I am able to...
2
by: eljainc | last post by:
Hello, I'm pretty new to C# programming, so be gentle with me. I have a block of code which is the following: scheduleDomainController1.ConnectionString = "data source=.\\SQLEXPRESS;"+...
0
by: rhepsi | last post by:
hi all, i have a project whre i have no. of students... I need to resize their photo to 300 x 400 pixels an 100 x 133 pixels (thumb size) here is my code: Its not at all executing..
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.