![]() |
|
|
Examining ASP.NET's Membership, Roles, and Profile - Part 15 When a visitor registers a new account on an ASP.NET website that uses the Membership system, they are prompted (by default) for their username, password, e-mail address, and other pertinent information. Along with functionality for registering new accounts, the ASP.NET Membership system provides page developers techniques for modifying information about users. For instance, with just a couple of lines of code you can change an existing user's e-mail address, approve a user, or unlock them (if their account was locked out). However, there are certain bits of user information that cannot be modified through the Membership API, such as the username. For most sites this is a non-issue. Once a visitor has registered an account that username is fixed; if they want a different username, well, they'll just have to register a new account. But consider a website that has customized the account creation process so that instead of prompting the user for both a username and e-mail address, the user is only asked to enter an e-mail address and that it is used as both their username and e-mail address on file. Anytime a user switched e-mail addresses - which can happen when changing jobs, changing ISPs, or moving to the new, hip, web-based e-mail provider of the day - they need to also change their username on your site.
In order to change a user's username we'll need to bypass the Membership API and work directly with the user store. This article shows how to interface directly with the
SQL Server database schema used by the
ASP.NET Master Page Advice, Tips, and Tricks
Master pages are an important part of any ASP.NET website. In a nutshell, a master page allows the page
developer to define a website template, indicating what portions of the template are to remain fixed across pages that use the template and what regions of the template
are customizable on a page-by-page basis. Having the site design and layout centralized in one (or more) master pages makes it easy to add new pages to the site that inherit
the same look and feel and greatly simplifies changing the site design or adding or removing content that is common to all pages, such as content in the
This article presents advice for using master pages, along with assorted tips and tricks that I've picked up over the years in using master pages. Read on to learn
more! And if you have additional recommendations and advice on using master pages, please don't hesitate to drop me a line
and I'll be happy to add your insight to this article.
Using ASP.NET 3.5's ListView and DataPager Controls: Inserting Data The ListView control is similar to the GridView control in many ways: both display a set of records, both support built-in sorting, paging, editing, and deleting functionality with minimal effort. The ListView differs from the GridView in two key ways:
The first installment in this series explored the ListView's template-based rendering. This installment looks at how to use the ListView's inserting functionality.
In a nutshell, inserting data from the ListView requires two steps: defining the inserting interface via the This article walks through the steps for creating a ListView that allows users to insert records. It also shows how to optionally cancel the inserting workflow based on programmatic logic. Read on to learn more!
(It is assumed that the reader is familiar with how to insert data using a data source control. If this
is not the case, please first read Accessing and Updating Data in ASP.NET:
Inserting Data.)
Using ASP.NET 3.5's ListView and DataPager Controls: Editing Data The GridView and DetailsView controls offer built-in editing functionality that can be turned on with the tick of a checkbox. Without writing a line of declarative markup or server-side source code, the page developer gets a decent out of the box editing interface. Namely, each field in the GridView or DetailsView is rendered in its editing interface; BoundFields display a TextBox control while CheckBoxFields display an enabled checkbox. Moreover, a CommandField is added, which displays the Edit, Update, and Cancel buttons, as needed.
While the ListView control provides editing support, it requires a bit more work from the page developer to get it going. The reason is because the ListView is defined by
templates whereas the GridView and DetailsView are defined by fields. Many fields types, such as the BoundField, can generate their own editing interface, but with templates
the page developer is on the hook for specifying the editing interface. Creating an editable ListView control entails defining the editing interface via the
This article walks through creating an editable ListView control, with the finished results available for download at the end of the article. Read on to learn more!
(It is assumed that the reader is familiar with how to edit data using a data source control. If this
is not the case, please first read Accessing and Updating Data in ASP.NET: Updating Basics.)
Implementing Incremental Navigation with ASP.NET Traditionally, website navigation has been focused on minimizing the number of clicks required to open a given page. However, this goal has nothing to do with the real purpose of navigation, which is to make finding information easy, consistent, and transparent to the user. Also, as websites get bigger, traditional navigation controls such as drop-down menus or tree views become impractical. Faster Internet connections and larger screen sizes now allow developers to experiment with new styles of navigation. This article shows how to implement incremental navigation, which is a style of navigation where users find information by clicking through a series of lightweight pages, with each click resulting in a small, but highly visible change to the navigation user interface. It differs from traditional drop-down menu navigation in that incremental navigation limits the amount of new choices available to just the next level in the sitemap hierarchy.
I've created a customizable framework for implementing this sort of navigation scheme named Theseus, which you can download from the end of this article. Underneath the
covers, Theseus uses ASP.NET's
Using ASP.NET 3.5's ListView and DataPager Controls: Deleting Data The previous installments in this article series have demonstrated how to display, group, sort, and page through data using the ListView control. In addition to displaying data, the ListView control also provides support for inserting, updating, and deleting data. If the ListView uses a data source control (such as a SqlDataSource or ObjectDataSource) and that data source control is configured to support insert, updating, or deleting, then implementing such functionality in the ListView does not require writing a single line of code. Rather, adding inserting and updating support entails creating templates that define the inserting and updating user interfaces and Button controls that trigger the actual update or insert. Implementing deleting support requires simply adding a properly configured Delete button to the ItemTemplate. This installment and the next explore how to perform inserts, updates, and deletes using the ListView control. This installment focuses on deleting and shows how to perform simple, standard deletes as well as more advanced deleting scenarios. The demos explored here (as well as the demos from previous installments) are available for download at the end of the article. Read on to learn more!
(It is assumed that the reader is familiar with how to delete data using a data source control. If this
is not the case, please first read Accessing and Updating Data in ASP.NET: Deleting Data.)
Examining ASP.NET 2.0's Membership, Roles, and Profile - Part 14 The ASP.NET Toolbox includes two Web controls for managing users' passwords: the ChangePassword control and the PasswordRecovery control. The ChangePassword control allows a user signed into the site to change their password by entering their existing password and their new, desired password. The PasswordRecovery control is used to reset or recover a user's password in the event that it has been forgotten. The PasswordRecovery control is used by anonymous users who need to be reminded of their password. Assuming that the Membership system is configured to require that users have a security question and answer (the default behavior), the user is presented with their security question and must correctly enter their security answer in order to have their password reset or recovered.
While there are two controls for managing passwords, there are no Web controls in the Toolbox for managing a user's security question and answer. In other words, there's no
built-in control that allows a signed in user to change her security question and answer. The good news is that while no control offers this functionality it's not difficult
to implement this feature ourselves. The
This article shows how to build a page that permits a signed in user to change their security question and answer, and a demo application is available for download at the
end of the article that showcases this functionality in action. Read on to learn more!
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||