Planning an ASP.NET Web Forms Application: Controllers and Testing

In spite of the many choices for web developers today, ASP.NET Web Forms is alive and well. One of the platform’s many strengths is its long history of stability. Microsoft has kept it current with frequent updates and the .NET Framework 4.7.1 continues to add features that can be utilized by Web Forms applications.

So what does that mean to you? If you are getting ready to build an ASP.NET Web Forms application, what should you consider?

My colleague, Ed Charbeneau, shares his thoughts and recommendations in the “Planning a Modern Web Forms Application” whitepaper. In this post, we’ll look at two excerpts from that paper – Using Controllers and Routing in Web Forms and Testing Methodologies. He explores the ability to take advantage of web API controller architecture without switching to ASP.NET MVC and he shares his thoughts on testing methodologies.

Using Controllers and Routing in Web Forms

Developers don't need to switch to ASP.NET MVC to take advantage of web API controller architecture in their application. Adding Web API controllers to Web Forms allows the application to leverage simple, but powerful JSON based REST endpoints. Web API endpoints provide a low friction way of supplying data for consumption by AJAX calls from the client side of the application. In addition, these endpoints allow Web Forms to share data with external applications such as reporting services, mobile applications and more.

Web API controllers can be added to a Web Forms application and any point in the application's development cycle. New projects can include Web API as part of the File > New > Project template experience, while existing applications only need to add a WebApiConfig.

By default, Web API will be configured to emit XML from controller actions. To enable JSON formatting simply remove the XmlFormatter from configuration.

Testing Methodologies

How you test and what you test is less important than the fact that you test something. It’s likely the case that you’ll want to test each module or unit of code by writing unit tests. When all of the units of code unite to form a running application, you’ll want to do functional end-to-end testing. Below I detail the tools required:

To take testing to the next level, consider complete a test automation solution for integration testing at the GUI level. One such way to integration test your GUI is with Progress Test Studio.

For a more detailed view of key considerations – software management tools, development process and methodology, tooling and development, backend methodologies, data and more – make sure to download Ed’s “Planning a Modern ASP.NET Web Forms Application” whitepaper.

And while you’re at it, if you haven’t played with Telerik UI for ASP.NET AJAX consider downloading a free trial. This feature-complete UI toolkit includes more than 100 controls, themes and more and enables you to quickly and easily deliver a sleek UI and delightful UX, increasing your productivity and your app’s performance.

Sara Faatz

Sara Faatz is a senior product marketing manager on the Progress Telerik UI for Xamarin team. She has spent the majority of her career in the developer space building community, producing events, creating marketing programs, and more. When she's not working, she likes diving with sharks, running, and watching hockey.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.