May 2008 - Posts

A New Tutorial Series on Master Pages
21 May 08 04:05 PM | Scott Mitchell

Over the past two years I've been working on a number of step-by-step tutorials for Microsoft's website. The two complete tutorial series are:

I'm happy to announce a new tutorial series of mine on the website on master pages. The first three tutorials are now available:

  • Creating a Site-Wide Layout Using Master Pages [VB | C#] - covers the basics of what master pages are and how to use them to define a site-wide layout.
  • Multiple ContentPlaceHolders and Default Content [VB | C#] - a master page can contain multiple ContentPlaceHolders. It's also possible to define default markup for a ConentPlaceHolder. Content pages can either emit this default content or override it with custom content.
  • Specifying the Title, Meta Tags, and Other HTML Headers in the Master Page [VB | C#] - typically the <head> section of a web page is contained in the master page and not the content page, so what do you do if the content page needs to define page-specific <head>-level markup? This tutorial shows how to customize the page's title, meta tags, and other HTML headers.

There will be a total of 10 tutorials. The next batch focuses on common master page challenges - creating non-breaking URLs and control ID naming and referencing, among other topics.

Like my past tutorials, these tutorials are all available in C# and VB versions, include a complete working source code download, and are available to download as PDF, as well.

Enjoy! -

Filed under:
Warning the User When Caps Lock is On
13 May 08 08:50 PM | Scott Mitchell

After my first batch of Security Tutorials were published on, a reader emailed me asking if it was possible to display some sort of warning if the user has Caps Lock on whilst entering their password into the Login control. While JavaScript cannot indicate if Caps Lock is on or not, you can ascertain whether it is once the user types an alphabetic key, as JavaScript can determine the key pressed and whether the Shift key was also pressed. In short, if the character is upper case and Shift is not depressed, or if the character is lowercase but Shift is depressed, then it follows that Caps Lock is on.

So it is possible to write a bit of JavaScript that fires when the user types a key into a TextBox and display some warning in response. This ASP.NET Forums post - Give Warning When Caps Lock On - discusses a JavaScript-based solution. The downside is that you have to paste in the necessary JavaScript into the page and add JavaScript to the TextBox control's onkeypressed client-side event. Wouldn't it be easier to be able to drag and drop a control onto the page, set a few properties and, presto, have a working Caps Lock warning?

My latest 4Guys article, Warning the User When Caps Lock is On, looks at building such a control. It is now part of my skmControls2 collection, which includes (currently) two other open-source server controls:

For more open-source, free tools, controls, and other funery, check out My Code Projects.


Filed under:
May's Toolbox Column Online
05 May 08 04:55 PM | Scott Mitchell

My Toolbox column in the May 2008 issue of MSDN Magazine is avaiable online. The May issue examines:

  • OmniAudit: a tool for creating SQL Server audit trails. OmniAudit offers a very slick and intuitive user interface for defining what tables and columns to audit and then generates the triggers and tracking tables needed to keep a log of changes to those tables and columns, including when the change was made, who made it, and past values. Also included is a log viewing program for searching the log history. (For more on audit logs, see Maintaining a Log of Database Changes.)
  • VSNETCodePrint: produce high-quality printouts of your Visual Studio code with VSNETCodePrint. Print (or export to PDF) all the code from an entire project or solution with the click of one button. Very useful for code reviews, user-group talks, conferences, training, and the like.
  • Blogs of Note - Joel On Software. Joel Spolsky, co-founder of FogBugz Software, shares his insights on user interface and leading a team of programmers in his interesting, entertaining, and well-written blog.
  • The Bookshelf - ASP.NET AJAX in Action, by Alessandro Gallo, David Barkol, and Rama Krishna Vavilala. Here is an excerpt from the book review:
The Microsoft ASP.NET AJAX framework simplifies the process of building AJAX-enabled Web applications by providing a rich and powerful, high-level API over the multitude of low-level interactions that must seamlessly occur between the client and server. Any book about the ASP.NET AJAX framework must balance the low- and high-level details. The space devoted to client-side issues like the XMLHttpRequest object and JSON must be weighed against coverage of the framework's Web controls and client- and server-side APIs. ... ASP.NET AJAX In Action starts from the low-level details and works its way up. ... ASP.NET AJAX In Action is not intended for beginning Web developers, as it assumes a certain level of familiarity with how to build ASP.NET applications, but this book is accessible regardless of past client-side or AJAX development experience.

Enjoy! -

As always, if you have any suggestions for products or books to review for the Toolbox column, please send them into

Filed under:
More Posts


My Books

  • Teach Yourself ASP.NET 4 in 24 Hours
  • Teach Yourself ASP.NET 3.5 in 24 Hours
  • Teach Yourself ASP.NET 2.0 in 24 Hours
  • ASP.NET Data Web Controls Kick Start
  • ASP.NET: Tips, Tutorials, and Code
  • Designing Active Server Pages
  • Teach Yourself Active Server Pages 3.0 in 21 Days

I am a Microsoft MVP for ASP.NET.

I am an ASPInsider.