Developer .NET UPDATE, August 1, 2003

Developer .NET UPDATE—brought to you by the Windows & .NET Magazine Network

This Issue Sponsored By

DevConnections--4 Events for the Price of 1

DevConnections Tour--The Conference Comes to You

August 1, 2003--In this issue:

1. Editor’s Note

2. Developer .NET Perspectives

  • Understanding the Community Starter Kit's Source Code

3. Announcements

  • Exchange 2003: Do You Plan to Migrate or Wait?
  • Learn More About the Security Risks in Exchange 2003

4. Events

  • New--Mobile & Wireless Road Show!

5. New and Improved

  • Automate .NET Security Testing

6. Contact Us

  • See this section for a list of ways to contact us.

Sponsor: DevConnections--4 Events for the Price of 1

DevConnections = Microsoft ASP.NET Connections + Visual Studio Connections + SQL Server Magazine Connections + Microsoft Office System Conference. Four conferences for the price of one with over 170 total sessions.

You can also save $200 via the Early Bird discount, but you must register soon before you miss this savings. All session and speaker information plus the conference brochure are online.

This is your chance to get the latest roadmap from Microsoft, learn practical tips and insights that you'll use on the job immediately, and network with the top gurus in the industry. Plus, you may win a brand new Harley Davidson motorcycle at the prize drawing held in the exhibit hall.

DevConnections is held Oct 12 - 15 in Palm Springs at the beautiful La Quinta Resort and Club. Don't miss this opportunity to get the training you need to stay on top of today's technology and keep your competitive edge. Register now online or call 800-438-6720 or 203-268-3204.

1. Editor’s Note

We'd like your opinion about Developer .NET UPDATE! To improve the editorial quality of this email newsletter and determine the best delivery format, we need your feedback. Please take some time to answer our online survey. The survey gives you the opportunity to provide feedback in one online survey about all the Windows & .NET Magazine Network newsletters to which you subscribe. We appreciate your time, and we look forward to reading your comments. To answer the survey, go to

2. Developer .NET Perspectives

by Bill Sheldon, [email protected]

  • Understanding the Community Starter Kit's Source Code
  • In "Reverse Engineering the Community Starter Kit's Source Code" ( and "Reverse Engineering Visual Studio .NET to Visio UML" (, I showed you how to use Microsoft Visio and the reverse engineering tools associated with Visual Studio .NET Enterprise Architect (VSEA) to look at the components in the Community Starter Kit. This kit is one of five sample ASP.NET implementations available on the Microsoft ASP.NET Web site ( ). Now let's look at the actual code and discuss the underlying implementation.

    The Windows .NET Framework has changed many application development paradigms. The Framework has also changed the ways developers can work with applications that support an HTML front end. In short, ASP.NET has changed the basic paradigm of Web-based applications on several fronts. Some of these fronts, such as Web services, I've already talked about in depth. The Community Starter Kit's front end introduces yet another way in which ASP.NET is changing how developers think about data-driven Web sites.

    Under most development models, Web sites consist of a set of pages that represent the various parts of the site. For example, the home page and the customer-settings page are two separate pages. Developers add new functionality to a Web site by adding a new page. In these Web sites, data-driven applications often populate a common framework with different data. Thousands of commerce Web sites follow this model for their catalog pages. Still, these sites tend to have a separate catalog page to which parameters are passed, with the idea being that a user's experience is associated with a multitude of specialized pages.

    In the Community Starter Kit, you'll find only two pages in the application: default.aspx and communitydefault.aspx. (Note that if you look in the Community Starter Kit directory, you'll find other .aspx files under the administration application, which is part of the starter kit. The administration application is separate from the community application. The administration application uses several different pages to build a traditional implementation.) The Community Starter Kit uses default.aspx, an error page, only when you don't have any communities defined on your site.

    Interestingly enough, default.aspx is the most common page name used in the client display. For most requests, the name of the page that the community site references is associated with an imaginary subdirectory. Thus, the site has several virtual default.aspx pages. The only other page names referenced from the client are those names for the other actions that occur at the same level as the default display for that section. For example, from the home page, you can carry out four common actions--search, logon, logout, and registration--each of which has a corresponding virtual page. However, as a truly data-driven application, even though the client interface reflects different pages and subdirectories, only a single page--communitydefault.aspx--works behind the scenes to handle each request.

    Unlike the default.aspx page, which contains a default display with no business logic, the communitydefault.aspx page contains no display and a small amount of .NET code. This code retrieves the data to display for the user.

    With only two .aspx pages, you might be wondering how the Community Starter Kit populates the page that it returns to the user. The communitydefault.aspx code looks at the requested URL and uses the starter kit's database to determine what to place in the page. The key here is that not much logic exists in the page implementation. The communitydefault.aspx page isn't a template for the returned page's contents. The communitydefault.aspx page is merely the execution point for putting together a response to the client.

    Several other Microsoft products, such as Content Management Server (CMS) 2002, use a similar application architecture. Categorized as a Windows 2003 Server, CMS supports the creation of templates that are then populated with content that resides in an associated Microsoft SQL Server database. I won't go into detail about how CMS works, but in short, it relies on one or more templates that are defined outside of SQL Server in conjunction with application data that's stored in SQL Server. As Microsoft notes on the Microsoft Content Management Server Web site (, the advantage of using CMS is that you can easily update the Web site's content. Thus, CMS supports the creation of dynamic data-driven Web sites that are ASP.NET-compatible.

    In the Community Starter Kit, the templates are ASP.NET user controls, which you can easily identify by their .ascx extensions. For information about these controls, go to

    The best way to understand this code in action is to follow its execution in debug mode. To activate VSEA's debug mode for this project, you need to modify a seldom-used setting in the web.config file for your application. If you open the web.config file in the application's root directory, you'll find the following snippet of XML code:


    <compilation debug="false" />

    To enable debugging for the application, change the value of the debug attribute from "false" to "true".

    The next step is to add a breakpoint to the communitydefault.aspx page. In VSEA, open the code view for communitydefault.aspx. Then in the communitydefault.aspx.vb file, locate the InitPage function and add a breakpoint where objPageSkin is defined as a control. Finally, make sure that default.aspx is the default start page for the application by right-clicking that page in the Solution Explorer, and select default.aspx as the default start page.

    Now let's start the debugger and take a detailed look at how the communitydefault.aspx code works. Here's an excerpt from that code

    Sub InitPage()

    Dim objPageSkin As Control = Nothing

    ' Create a StringBuilder object to build the page head.
    Dim objBuilder As New StringBuilder()
    objBuilder.Append("<html>" + vbLf + "<head>")
    ' Add the page title.
    objBuilder.AppendFormat(vbLf + "<title>\{0\}</title>", _

    Controls.Add(New LiteralControl(objBuilder.ToString()))

    ' Load the page skin.
    objPageSkin = LoadControl((CommunityGlobals.AppPath + _
    "/Communities/" + objSectionInfo.Skin + _

    ' Add the page skin to the form.

    End Sub ' Page_Init

    As you can see, the code first creates instances of some objects, including the StringBuilder object. StringBuilder is an excellent tool for speeding the concatenation of strings. Instead of managing a string as a single entity, this object manages the characters that make up the string, which facilitates faster processing.

    Next, the code concatenates some standard headers and assigns the concatenated string to the StringBuilder object. The code then uses the StringBuilder object's value to create a control that's added to the collection of controls that make up the requested page. The code at callout A programmatically assigns the new control containing the page header information to the page. Similar to the Trace and Debug objects, the Controls object is part of the HTTP context under which the page executes.

    The calls at callout B define the framework for the data in the page. Referred to as the "skin," this control is a predefined template that manages the display of the majority of the data associated with the requested page. As the code at callout B shows, the path used to load the appropriate template includes several variables that are evaluated at runtime. CommunityGlobals.AppPath evaluates to the relative path that leads to the application files. This path is the same for any requested page. The objSectionInfo.Skin evaluates to the skin. The skin is retrieved from the Community Starter Kit's database. Specifically, it's in the Section_PageSkin column of the Community_Sections table.

    The Community_Sections table lists each of the virtual subdirectories in the application as a section. By default, there is only one skin listed for all the sections in the application, and it's associated with the "Home" or default section for the community. To change the overall look of the display, you can change the path located in this field.

    As you can see by looking at the code in communitydefault.aspx, ASP.NET lets you use custom controls at runtime to dynamically implement multiple different pages. As a result, you need only one .aspx page to implement an entire application. With the Framework and user controls, you have a way to build truly data-driven applications. Next time, look at how Microsoft IIS knows to always call this same page even when the user passes the URL for another page.

    Sponsor: DevConnections Tour--The Conference Comes to You

    Can't make it to one of our major conferences? We will bring the conference to you. Join Paul Litwin and Carl Franklin for 2 days of solid, in-depth training in ASP.NET and VB .NET. Special keynote by Microsoft's Rob Howard.

    Attend either the ASP or VB track for the entire two days or move from one track to the other as you desire. Don't miss this chance to get in-depth training from the experts in a highly interactive environment. Bring your questions and get the answers you need. You'll discover new tips and shortcuts to help you build better and more secure applications and web services faster.

    Coming to a city near you. Get ready for the transition in development by learning from the best and keep your competitive edge.

    Register today before these events sell out:

    3. Announcements
    (brought to you by Windows & .NET Magazine and its partners)

  • Exchange 2003: Do You Plan to Migrate or Wait?

  • Windows & .NET Magazine and Aelita Software would like to know about your organization's plans to migrate to Exchange Server 2003. Take our brief survey, "Windows & .NET Magazine: The State of Exchange Migration," and sign up to receive a free white paper titled, "Upgrade or Migrate? Deployment Options for Exchange 2000/2003." Give us your feedback today!

  • Attention Visitors to Learn More About the Security Risks in Exchange 2003

  • Videotaped live at Microsoft TechEd 2003, this free archived Web seminar delivers an introduction to the new security features and enhancements of Exchange Server 2003, including the new security APIs that can minimize virus risk and spam traffic. Plus, you'll discover more about the future of the messaging industry and what's on the horizon in assessing risk. Register today!

    4. Events
    (brought to you by Windows & .NET Magazine)

  • New--Mobile & Wireless Road Show!
  • Learn more about the wireless and mobility solutions that are available today! Register now for this free event!

    5. New and Improved
    by Sue Cooper, [email protected]

  • Automate .NET Security Testing
  • Desaware announced CAS/Tester, software to automate the process of testing an assembly by executing it under multiple security configurations. You have the option of using the product's command-line utility or a GUI-based add-on that integrates into Microsoft Visual Studio .NET 2003. You can run an application or invoke a method as a simple test; create sophisticated test scripts in Visual Basic .NET or Visual C# .NET; or invoke outside test assemblies or test harnesses. Output includes detailed information including permissions tested and any exceptions that occurred. CAS/Tester's XML format output lends itself to further test automation. Introductory pricing is $399. Contact Desaware at 408-377-4770 or [email protected]

    Sponsored Links

    FREE live trial-Backup & Disaster Recovery software w/ encryption;5945485;8214395;x?

    Free Download - NEW NetOp 7.6 - faster, more secure, remote support;5930423;8214395;j?

    6. Contact Us

  • About Developer .NET Perspectives -- [email protected]
  • About the newsletter -- [email protected]
  • About technical questions --
  • About product news -- [email protected]
  • About your subscription -- [email protected]
  • About sponsoring UPDATE -- [email protected]
  • This email newsletter is brought to you by Windows & .NET Magazine, the leading publication for IT professionals deploying Windows and related technologies. Subscribe today.

    Copyright 2003, Penton Media, Inc.

    Hide comments


    • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

    Plain text

    • No HTML tags allowed.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs break automatically.