Home > Articles > Programming > Windows Programming

ASP.NET 4 Unleashed: An Interview with Kevin Hoffman and Nate Dudek

Eric Vogel interviews Kevin Hoffman and Nate Dudek, two of the co-authors of ASP.NET 4 Unleashed. Kevin and Nate talk about why you should upgrade to ASP.NET 4, their opinion on the Update Panel, and what HTML5 will bring to the table.
Like this article? We recommend

Like this article? We recommend

ASP.NET has been around since January of 2002 and has since improved drastically with each release. With each release comes a new set of controls, new server and client functionality, and sometimes even new paradigms that enable you as a developer to be more productive. ASP.NET 4 Unleashed by industry experts Kevin Hoffman and Nate Dudek is a treasure chest of knowledge for the fourth iteration of the well known framework.

I have been working with ASP.NET for close to four years at A.J. Boggs & Company. When I found out I had the privilege to interview ASP.NET experts Kevin and Nate I decided to ask them some in depth questions about their book, the ASP.NET Framework in general and the future of web development.

Eric Vogel: Who would you say is the target audience for ASP.NET 4 Unleashed, and do you feel you hit your mark?

Nate Dudek: Developers of all levels will get something out of ASP.NET 4 Unleashed. The early chapters of the book start at the very beginning—installing ASP.NET and getting comfortable with Visual Studio 2010—and lets novice developers get their feet wet by building small websites and walking through all of the different controls.  In the later chapters, you’ll find more advanced concepts such as data paging, writing custom providers, AJAX, and new features such as Dynamic Data.  There’s something for everyone.

Eric: If you are currently using ASP.NET 2.0 or 3.5, what is the main motivating factor to upgrade to ASP.NET 4.0?

Nate: For applications that are actively being developed or updated, there are some clear advantages to upgrading to .NET 4.  First of all, Visual Studio 2010 is by far the best version of the product yet.  It’s fast, and the new editor, upgraded Intellisense, and new navigation features are fantastic. ASP.NET, specifically, the web.config files have been dramatically simplified and are much cleaner to read and maintain.  There have also been a lot of changes related to producing cleaner and standards-compliant HTML and CSS.  Many of the controls, such as the validation labels, no longer render inline CSS, which gives you better control over the styling of your site.  Controls like the Menu and FormView also give you the option of disabling the HTML table that was previously always rendered.  Features such as Routing are fantastic for search engine optimization.  These types of changes allow developers to more easily build clean, standards-compliant websites.

Eric: What role do you think ASP.NET MVC has to play in the future of ASP.NET? Do you see it as more of a replacement or a complement to Web Forms?

Nate: ASP.NET MVC is definitely a complementary addition to the ASP.NET framework. Traditional ASP.NET WebForms development will continue to be strong, but MVC is a great choice for applications looking to do rapid or test-driven development. It also helps enforce a clean separation of concerns by design. For developers who have experience with Ruby on Rails or other languages, it will be a familiar pattern.

Eric: What is your general rule of thumb on using ViewState and ControlState for controls? Do you generally disable ViewState unless it is needed in order to reduce the page size?

Nate: ViewState is one of those things that has received a bad name over the years, mostly due to developer abuse. When used properly, it can be a great tool. What developers need to remember is that anything in the page ViewState will get rendered out in a hidden field in the client-side HTML, which results in a larger page. We’ve seen enterprise applications where huge datasets are explicitly placed in ViewState—in one case causing a page size of over 100MB! Needless to say, it didn’t perform very well. ViewState should definitely be disabled in the scenarios where it’s not used, and objects should almost never be explicitly placed in ViewState through code unless absolutely necessary. ASP.NET 4 includes a new property called “ViewStateMode” which enables developers to disable ViewState by default, and then selectively enable it on controls that require it. It’s a nice addition, since previously it was always enabled by default and disabling it was done on a control-by-control basis. GridViews and some of the third party controls out there tend to be ViewState hogs in certain scenarios, and it should always be optimized before pushing a page to a production application.

Eric: What is your take on the ASP.NET Update Panel? When do you favor using a client side AJAX library such as jQuery instead for AJAX requests?

Nate: When the UpdatePanel control was first introduced into the ASP.NET framework, AJAX and the rich web as we know it was just emerging. For developers who were comfortable with ASP.NET development, it was an incredibly easy way for them to introduce asynchronous requests into their applications in a way that they were used to.  Now that we have rich, easy-to-use client side libraries such as jQuery, it’s much easier to implement almost any client-side you can think of using only JavaScript.  Personally, I use jQuery for almost all of my AJAX requests.  It’s cleaner in my opinion, and faster.  But, for ASP.NET developers who aren’t as comfortable with JavaScript, the UpdatePanel is still a great option to rapidly introduce AJAX into applications in a way that’s still consistent and maintainable.

Eric: When would you recommend that someone start out with an ASP.NET Dynamic Data Web Application, and conversely, when would you recommend not using a Dynamic Data Web Application?

Nate: If you take a look at the basic needs of your application, and it boils down to mostly CRUD (Create, Retrieve, Update, Delete) functionality with validation, and most of the "work" of your application is in coming up with the UI on top of a pretty straightforward data model, then I think Dynamic Data web applications might be something you should look into and might get you to production super fast. Additionally, if you want to rapidly prototype a fully functioning web application, then dynamic data can also be helpful. Despite its name, you can slowly remove the implicit (dynamic) stuff and replace it with more robust UI features. It's hard to generalize, but if your application is more involved than just performing CRUD operations on data (e.g., your application works more like using UI to advance workflow than perform simple data manipulation), then dynamic data might actually hamstring your efforts. If you have a full-featured middle tier, are using a third party middleware product, or your app sits on top of services rather than direct data, these are all scenarios that diverge from dynamic data's target audience. That's not to say that DD can't be adapted to those environments, but often the work of adapting dynamic data to those environments is more than just going with a more traditional Web Forms or ASP.NET MVC approach.

Eric: There has been a lot of debate on whether to use LINQ to SQL or Entity Framework when deciding on an OR/M for an ASP.NET Web Application. In your book you focus on LINQ to SQL. Is there a reason you chose LINQ to SQL over Entity Framework to demonstrate?

Kevin Hofffman: Throughout the book LINQ to SQL is used instead of Entity Framework for the sake of simplicity. If the code I want to show is in the UI, but I need data for the demo, LINQ to SQL can give me that data in the fewest lines of code with the smallest amount of impedance between what my UI wants and what my database contains. It also satisfies a large number of problems that many of this book's readers either have now or might have tomorrow. That said, there are a lot of compelling arguments for using the Entity Framework as well. Entity Framework allows you to model entities at a higher level of abstraction than simple database tables. While I can achieve some distance from tables and columns in LINQ to SQL, Entity Framework allows me to do true domain-driven design (DDD). This entity model can be used to produce multi-purpose POCOs (Plain Old CLR Objects), self-tracking C# objects that can be used as DTOs (Domain/Data Transfer Objects), and finally, the Entity Framework's persistence medium is abstracted as well. This means that if I want to, I can have my entity model talk to an Oracle database. LINQ to SQL, as its name implies, works only on SQL databases. In general I usually suggest that for small projects (especially those that might qualify for an ASP.NET Dynamic Data front-end), LINQ to SQL is ideal. However, the bigger your data store and the more complicated your domain model, the more often I recommend Entity Framework.

Eric: The new QueryExtender control allows for easy filtering of sorting data in a declarative way. Are there any pitfalls that you have run into with the QueryExtender control? 

Kevin: The only pitfalls I've seen with the QueryExtender are the same as those with using LINQ queries in your code that eventually become SQL queries. This happens with LINQ to SQL and Entity Framework. Developers unfamiliar with how LINQ queries become SQL queries can unintentionally write poorly performing queries that look perfectly fine in code (or as parameters to the QueryExtender control). A little caution and some time spent in SQL profiler watching the queries you execute before you go to production can go a long way here.

Eric: What are your thoughts on the URL routing additions to ASP.NET 4.0? Do you see it as an easy way to bridge the gap across Web Forms and MVC?

Kevin: I love the URL routing additions. I've always been a huge fan and proponent of RESTful architecture, and the URL routing additions allow both ASP.NET and ASP.NET MVC to provide web applications with a RESTful URL style. The URL routing additions are now a part of the core of ASP.NET and that's a good thing for everyone. That said, I don't think they are a way of bridging an imaginary gap between Web Forms and MVC. Web Forms and MVC are two different ways of building ASP.NET applications, each with their own benefits and drawbacks and each with appeal to a different type of developer or project. URL routing bridges the gap between Web Forms and MVC only in the same way that Xaml bridges the gap between Silverlight and WPF—URL routing is just a common tool available to both frameworks.

Eric: What features would you like to see implemented in ASP.NET 5.0?

Kevin: I would love to see tighter integration between ASP.NET's request handling engine and some of the new asynchronous/multi-threading features coming in C# 5.0. I also think that HTML5 is the future of the web (not Silverlight or Flash or Java), and I want to see ASP.NET 5 completely embrace this with controls, APIs, tooling, and samples that allow for seamless integration of HTML5's client-side networking and data-binding with ASP.NET's server components. For example, HTML5 has a WebSocket that can be used to deliver "push" data to code running client-side in a browser. It would be awesome if ASP.NET (as opposed to other third-party, mostly Java-based servers) could serve as a Comet/WebSocket server rather than today's only .NET alternative—the Silverlight/WCF Duplex polling channel.

Eric: As web developers, what excites you the most about what HTML5 will bring to the table in the near future?

Kevin: As mentioned in my answer to the ASP.NET 5 question, HTML5 has really exciting networking and data capabilities that, when combined with other client-side tools like jQuery and CSS, create the perfect storm for the most compelling in-browser application experiences we've seen so far. If it really does gain widespread traction as a standard, then we could have "just" HTML5/jQuery/CSS code that provides cross-platform desktop and mobile application experiences.

Eric: What do you feel distinguishes your book from the all the rest?

Kevin: I think the one thing you'll notice as soon as you pick it up (especially given its weight and page count) is how thorough this book is. It doesn't just give you an overview and then tell you to go look at other books for the detail. This is the biggest, most complete compendium of ASP.NET 4 information you're going to find in print anywhere. Not only that, but the people who wrote this book aren't just authors, we're developers and architects who spend all day (and most of our nights) knee-deep in ASP.NET code, so the book is filled with samples, tips, and practical sidebars that you might not find in other books that just repurpose MSDN, blogs, and other online documentation for print form.

Nate: ASP.NET 4 Unleashed is exhaustingly thorough. At just over 1900 pages, we feel like we crammed as much information as physically possible into a single book.  It covers the entire framework, from control overviews to new features, basic configuration to advanced techniques—it makes a great page-by-page tutorial, but is just as good as a desktop reference for expert developers.  It’s truly a one-stop shop for everything you may need to know to build, debug and deploy a fully featured application.

I would like to express my gratitude to Kevin Hoffman, Nate Dudek, and InformIT for providing me with the privilege to conduct this interview.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020