![]() |
|
|
Warning the User when Caps Lock is On Most security systems' passwords are case-sensitive. Case sensitivity nearly doubles the number of possible characters that can appear in the password, which makes it harder for nefarious users trying to break into the system. As a result, if a user logging into the system has Caps Lock turned on, they'll enter letters in the opposite case and not be able to login. Because the textboxes that collect user input typically are masked to prevent an onlooker from seeing a user's password, the user typing in her password may not realize that Caps Lock is on. To help prevent this type of user error, many login screens for desktop-based applications display some sort of warning if the user's Caps Lock is on when they start typing in their password. Unfortunately, such functionality is rarely seen in web applications. A 4Guys reader recently asked me if there was a way to provide such feedback to a user logging into an ASP.NET website. The short answer is, Yes. It is possible to detect whether a user has Caps Lock enabled through JavaScript. Likewise, it's possible to have this client-side logic execute whenever a user starts typing in a particular textbox. With a little bit of scripting, such an interface could be devised.
After thinking about the implementation a bit, I decided to create a compiled server-side control that would emit the necessary JavaScript. This article
introduces this control, WarnWhenCapsLockIsOn, and shows how it works and how to use it in an ASP.NET web page. Read on to learn more!
Microsoft's ASP.NET AJAX Framework helps page developers design more interactive web pages by streamlining the postback mechanism. In traditional web pages, a full postback involves the browser re-requesting the page, which is then re-rendered. This re-rendered page markup is returned, in its entirety, to the browser for display. Ajax techniques improve the user's experience in two primary ways through the use of partial postbacks: first, a partial postback is asynchronous, meaning that the user can still interact with the page while waiting for the partial postback to complete; second, and more importantly, because a partial page postback updates only a particular region (or regions) of a page, less data needs to be shuttled between the client and the server, resulting in a quicker and smoother experience. One benefit of full page postbacks is that the browser provides a number of cues to the user that a postback is underway. Upon the initiation of a postback, the little Internet icon in the browser's upper right corner starts spinning and a progress indicator is shown in the status bar, among other signs. With a partial page postback, however, no feedback is provided to the user. Consequently, a user may have instigated a partial page postback, but not realize it if the response is lagging. This may prompt them to click the button (or whatever instigated the partial postback) again, or they may just decry your website as buggy and close their browser, never to return again!
The good news is that the ASP.NET AJAX Framework includes the UpdateProgress control, a Web control designed specifically for providing visual feedback to
a user during a long-running partial page postback. This article examines using the UpdateProgress. Read on to learn more!
Working with XML Data Using LINQ, a TreeView, and a ListView :: Editing Data ASP.NET includes a variety of tools for displaying and editing XML documents. A previous article, Working with XML Data Using LINQ, a TreeView, and a ListView :: Displaying Data, showed how with a TreeView control, a ListView control, an XmlDataSource control, a LinqDataSource control, and about 50 lines of code we could create a web page that displayed the contents of a hierarchical XML file. Specifically, the page displayed the contents from a fictional employee phonebook, which allowed for an arbitrary number of employees nested within branches and departments. The TreeView and XmlDataSource controls displayed the various branches and departments, while the ListView and LinqDataSource controls displayed the employees belonging to the selected branch or department (or one of its subdepartments).
In addition to displaying data, the ListView and LinqDataSource controls can be augmented to edit, insert, and delete data. This article examines how
to update the ListView and code to enable the visitor to add, edit, and delete employee phone records. By the conclusion of this article we will have
constructed a web page that displays XML data and enables an end user to modify the data from a simple, easy-to-use web page interface. Read on to
learn more!
Working with XML Data Using LINQ, a TreeView, and a ListView :: Displaying Data With more and more data being stored in XML, web applications today commonly need some way to view and edit the data stored in an XML file from a web page interface. If the XML data is relatively "flat" and tabular in nature, we can use data Web controls like the DataGrid, GridView, and Repeater. (See Quickly Editing XML Data for an example of editing XML data through a DataGrid control.) But what if the XML data is more hierarchical and in a less tabular format? Consider a company-wide phone book, which is recursively structured into branches and departments, subdepartments, and so forth. How can this XML data, which can have any number of nodes and any level of children, be displayed and edited through a web page? In this article we will build a web page that displays the contents of a company-wide phone book whose information is encoded in an XML file. The page will recursively display the phone book XML data using a TreeView to list the branches and departments and a ListView to enumerate the employees that belong to the selected branch or department. In particular, the ListView will display the employees that belong to the selected branch or department as well as all the employees that belong to any subdepartments. (In a future article we will look at how to extend the ListView to enable the user to add, edit, and delete phone book entries.)
Read on to learn more!
Examining ASP.NET's Membership, Roles, and Profile - Part 10
The Membership system automatically tracks the last
date and time each user's account has been accessed. With the
In addition to tracking each user's last activity date and time, the Membership system includes a method named
This article, the tenth installment of a multipart article series on ASP.NET's Membership, Roles, and Profile systems, examines
the
Creating an Online Boggle Solver :: Solving the Puzzle My family enjoys playing games and one of our favorites is Boggle, an addictive word game where players attempt to find as many words in a 4x4 grid of letters. At the end of a game, players are left wondering whether there were any unearthed words. To answer this question once and for all, I created an online Boggle solver using ASP.NET version 3.5.
This article is the second installment in a two-part series. Last week's article, Building
the User Interface, examined the Boggle solver web page's user interface, which consists of 16 TextBox Web controls arranged in a 4x4 grid and three
Button Web controls for solving the user-entered puzzle, solving a randomly-generated puzzle, and clearing the board. A ListView control is used to display
the solutions in a three-column HTML This second and final installment details the code used to solve the puzzle. Solving the puzzle requires having a dictionary of legal words and objects that mirror the structure and functionality of the board and of solutions. These objects are implemented as classes that include internal data structures that use a number of features in the .NET Framework, including: Generics; automatic properties; and caching. The complete source code is available for download at the end of the article.
Try out the live demo or read on to learn more!
Creating an Online Boggle Solver :: Building the User Interface I spend most of my day writing about ASP.NET or building ASP.NET applications for clients. As every ASP.NET developer knows, the bulk of ASP.NET development centers around data access - building pages to collect user input and crafting reports to summarize that information. To help break this monotony, I occasionally set aside an afternoon to work on a more interesting project, which helps rechage my batteries. I've shared such fun programming projects in past articles here on 4Guys (see Creating a Quick and Dirty Online Blackjack Game). My immediate and extended family enjoys playing games, and one of the favorites is Boggle. Boggle is a word game trademarked by Parker Brothers and Hasbro that involves several players trying to find as many words as they can in a 4x4 grid of letters. At the end of the game, players compare the words they found. During this comparison I've always wondered what words we may have missed. Was there some elusive 10-letter word that no one unearthed? Did we only discover 25 solutions when there were 200 or more? To answer these questions, I decided to create a Boggle solver and did so using ASP.NET version 3.5. The Boggle solver recursively explores the board and locates (and displays) all available solutions. With this nifty little web page, at the conclusion of each Boggle game we can see what words we missed.
This article is the first in a two-part series that details the application, its design, and some of the challenges faced when creating it. In this first
installment we will look at the user interface; the second installment examines the logic used to actually solve the puzzle. The complete source code
for the Boggle solving application is available at the end of the article. You can also see a live demo in action at www.ScottOnWriting.NET/Boggle.
Read on to learn more about this fun little project.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||