ASP.NET application developers are in high demand now, as more companies look to carve out a competitive advantage through better custom software programming. Exerienced developers commonly field multiple offers, evidence of an ever shrinking talent pool. That may be great news for job seekers, but it’s a stressor for employers.
In this tough hiring market, managers have to be ready to quickly assess talent and make the right offer to the right candidate. The Robert Half Salary Guide can help you determine the average starting pay for ASP.NET application developers in your area. But if you’re not an expert in this framework, evaluating candidates will be a challenge.
To help you identify the best fit for your company’s needs, we’ve prepared a list of ASP.NET interview questions you can put to your top candidates. Tailor the questions so they address the specific role you’re looking to staff, of course. And if you’re at all uncomfortable talking tech, bring in someone from your IT team or a specialized staffing professional who can help with the interviewing and vetting. You don’t want to go with your gut here.
ASP.NET interview questions: the basics
Warm up with some general queries that should be fairly easy for anyone with a working knowledge of the framework. Listen carefully to the way candidates respond to learn how they communicate and solve problems.
1. What is ASP.NET, and why do we use it?
Here, some candidates will focus on the development side and discuss ease of deployment, multi-language support or compatibility with popular databases. Other interviewees may fixate more on outcomes, such as how ASP.NET can be used to build dynamic websites and applications, how it scales up easily and how it is supported by a global development community.
Either way, this question tells you a lot about how candidates view the nature of the ASP.NET application developer role. It also helps you evaluate their ability to explain difficult technical concepts to non-experts, a crucial soft skill.
2. What is ASP.NET Core?
ASP.NET Core is an open-source version of Microsoft’s ASP.NET. First released in 2016, ASP.NET Core runs on macOS and Linux as well as Windows. The framework has been extensively rewritten, with changes such as the MVC and Web API being integrated into a single model.
3. How does .NET support multiple languages?
This basic ASP.NET interview question can be deceptively hard to answer, but it helps separate candidates who only know the fact that .NET provides multi-language support from those who have a deeper understanding of how this takes place.
A strong response to this question might sound something like: “To be classified as a .NET language, it has to comply with the Common Language Runtime standard. Code in .NET is compiled to the Microsoft Intermediate Language. After it’s compiled to the Intermediate Language, language is not a barrier. Code can use or call functions written in other languages.”
4. What is a postback?
A postback occurs when clients request a server response from the page they’re viewing. A simple example of this is a user completing a form and pressing a “submit” button. In this instance, the IsPostBack property is true, so the server processes a request and sends a response back to the client.
A postback will refresh the entire page, while a request to simply retrieve data without fully refreshing is done with a callback.
We can help you with your next hire:
ASP.NET interview questions: into the weeds
After you’ve covered the basics, you can further assess the extent of candidates’ expertise with these more in-depth questions:
5. If a try-catch block doesn’t find an exception, what happens to the finally block?
Try-catch is a method of handling exceptions in C# and other languages. It’s effectively a plan B — a way of saying “try this and if it doesn’t work, then do this.” The finally block happens afterwards, and it always executes, whether there has been an exception or not.
Try-catch and finally will be very familiar to more experienced developers who have worked in production environments.
6. What are the advantages and disadvantages of user controls and custom controls?
This ASP.NET interview question targets two key areas: the interviewees’ knowledge and their approach to ASP.NET application design. It’s important not to concentrate too much on factual questions whose answers can be easily found online. Gauging candidates’ ability to apply what they’ve learned is much more beneficial. Some key differences between user and custom controls:
- User controls are easier to create but provide limited support for consumers using visual design tools. They’re best suited for static layouts.
- Custom controls take more time to build but offer full visual design tool support. They’re good for a dynamic layout.
7. What are some of the page events in the life cycle of an ASP.NET page?
The life cycle of an ASP.NET page travels through several different events as the page runs. This question is of an applied technical nature for ASP.NET developers, since it demands familiarity with the entire life cycle, as well as the process of implementing and maintaining the correct code and controls for each stage. Common page events include:
- PreInit, which occurs after the completion of the start stage but before the initialization stage begins. During this event, the developer can create dynamic controls, set the master page and theme property dynamically and read the profile property values.
- InitComplete, which occurs toward the end of the initialization stage. During this event, changes to the ViewState can be applied past the next postback.
- Control events, which occur during the Load stage. During this stage, the ASP.NET developer handles specific control events, such as the TextChanged event in the TextBox control or the Click event in the Button control.
8. What versions of IIS have you worked with?
Internet Information Services (IIS) is an extensible web server that supports a variety of common Microsoft transfer protocols. There are several versions of IIS — the current one is 10.0, which includes support for HTTP/2 — with a range of design configurations and processing capabilities.
The slow-changing nature of many enterprise web server systems means developers may not have worked with the latest version of IIS in previous positions. This question helps ensure your top candidates either have experience working with the IIS version you use or enough familiarity with similar versions to make the transition.
9. How do you prevent CSRF attacks?
ASP.NET interview questions like this will tell you about candidates’ experience with real-world applications and their awareness of security issues. A Cross-Site Request Forgery (CSRF) involves sending a fake request from the user’s browser to a web application. If the user has an active session, this request can potentially be actioned within the application.
In ASP.NET, such attacks can easily be prevented with authentication tokens. C# has the ValidateAntiForgeryToken attribute, which follows up a screen request by issuing a token. The token is returned with the request and validated server-side, ensuring the request is genuine. If desired, you can follow this up with further questions about how ASP.NET deals with other security issues.
10. What is MVC in ASP.NET?
Model-View-Controller (MVC) is a lightweight architecture that makes it much easier to build and test ASP.NET web applications. It’s vital to include a discussion of MVC in your interview. MVC breaks each application down into three parts:
- Model — The data domain of the application, normally an actual SQL database. Model objects retrieve and update records.
- View — The visual components that constitute the user interface.
- Controller — The components that deal with user interactions, such as keyboard input. Controllers influence views and can also pass values to the model.
MVC supersedes the older web forms structure of ASP.NET, so follow-up interview questions could ask about this difference. A developer should know the main advantage of ASP.NET MVC over ASP.NET Web Forms is that each part can be tested separately, without the need to load the entire application, allowing for speedy test-driven development.
11. How do you use multiple models to a single view in ASP.NET?
ASP.NET MVC allows only one model to be bound to each view, but there are several workarounds for this. Candidates may discuss some or all of these solutions when answering. For example, the ASP.NET framework includes the class ExpandoObject, which is a dynamic model that can be passed to the view.
Another common solution is to use the ViewModel class (a single class with multiple models), ViewData (a dictionary object) or ViewBag (a dynamic type property of the ControllerBase class). JSON, Tuple and RenderAction can also be used.
Strong candidates should be able to talk through their chosen solution and explain how it works. The answer to this ASP.NET interview question offers insight into developers’ understanding of the framework and their approach to application building.
12. What is the difference between stateful and stateless?
This query covers some fundamental aspects of ASP.NET application development. The web protocol HTTP is stateless because it doesn’t have built-in support for recording states. For example, it doesn’t store information about what actions a user has taken during a session.
ASP.NET Web Forms tried to make stateful web applications with ViewState, which handled session cookies and session identifiers in a transparent way. The application state was managed on the server. ASP.NET MVC is considered stateless because it doesn’t use server-side controls to maintain state. Instead, the session is managed dynamically by the Model-View-Controller components.
Effective ASP.NET interview questions balance an assessment of acumen and understanding of the framework. You could also ask about past projects candidates are particularly proud of, or the kinds of work they would like to do going forward. These questions provide insight into how developers approach their careers. In turn, you get to show you’re committed to combining candidates’ goals with your company’s objectives.