Depending on your Asp.Net Membership Provider Settings, you may be able to use the
Reset Password Panel to:
- Change a member's password
- Change the passwordFormat for a member
-
Change the Question And Answer for a member
The reset function completely replaces a member's credentials with those
you specify and, since it works with Hashed passwords, it is often the
only way to help a customer who has failed all other attempts to recover his/her
password.
While the Reset Password panel is quite powerful, it is still limited by
the configuration options of the underlying SqlMembershipProvider. As outlined in
the article,
Asp.Net Membership Provider Password Administration,
the following configuration options must be set in order to call the series of provider
methods required to reset the members' password:
- The members' password must be stored in a Clear text format
or...
- The MembershipProvider.RequiresQuestionAndAnswer property must
be set to false.
- The MembershipProvider.EnablePasswordReset
property must be set to true.
- If attempting to change a members'
passwordFormat to Encrypted, a <machineKey>
section must be defined in web.config.
Each of these elements is described in the topic
Asp.Net Membership Provider Settings,
which also describes how to create appropriate entries in your application's web.config
file.
Anticipating Exceptions
Since the Membership Manager Control depends on the configuration of your Membership
Provider, certain exceptions may be anticipated if you have not properly configured
the Asp.Net SqlMembershipProvider.
The following configuration topics explain the various messages you might receive
while using the Reset Password Panel:
Index was outside the bounds of the array
You must specify a non-autogenerated machine key..
Unable to reset password unless EnablePasswordReset..
Unable to reset password unless RequiresQuestionAndAnswer..
Customizing the view (design time)
The Heading Text and passwordFormat prompt may be modified by changing the
ResetPasswordTitle
and
ResetPasswordFormatPrompt properties in the Visual Studio 2005 Properties
pane. Similarly, the Confirmation text box prompt and the text that links to the advanced (Reset Password) view may be set with the
ConfirmPasswordPrompt and
ResetPasswordLinkText properties.
While simple label and style changes might be adequate for your needs, you may also
wish to take advantage of the
Convert to Template option which exposes
the view's constituent web controls for formatting and editing.
As illustrated, the Tasks panel includes an option to select the desired view then
Convert to Template changes it to a templated panel.
Just like the Asp.Net Login Controls, templated views allow you to change the layout
and content of the panel. You actually have a lot of flexibility when doing so,
however you must not delete or change the name of the active controls such as the
text box, the OK button or the Cancel Button.
The following is an example of a panel that has been converted to a template then
customized with additional controls:
As you can see, the modified control may contain additional controls and varied formatting.
Control properties do not apply to templated views
When you convert a view to a templated view, the constituent controls are created
using the current properties which have been set (styles, text, etc.) The next time
you refresh the page, you may notice that properties related to the now-templated
view are no longer listed in the Visual Studio 2005 Properties pane. This
is by design and it is assumed that you will be setting properties on the controls
themselves.
If you want to discard your templated changes, just bring up the tasks menu and
click the
Reset option as illustrated below. Caution: Reset will immediately
discard any changes you have made to your custom view template. Of course, nothing
is permanent until you save the file.