8 ASP.NET Interview Questions to Help You Find the Right Developer

By Robert Half September 7, 2017 at 9:00pm

The role of ASP.NET application developer is in high demand now, as more companies look to carve out a competitive advantage through better custom software programming. But before that ASP.NET developer job ad is posted, you should be mindful of two things:

First, because their skills are in high demand, experienced ASP.NET applicants can afford to be picky about the companies they work for, the projects they take on and the compensation they will accept. Second, don’t overlook talented but less-experienced professionals who could be the right application developer if given the necessary training, such as a class on ASP.NET Core MVC 5 or a video tutorial on Angular 2.

To help ensure you hire a qualified ASP.NET application developer for your organization — and show prospective hires that you have an appreciation for the nuances of their technology specialization — consider asking these eight ASP.NET questions during the interview process:

1. How does .NET support multiple languages?

Although this is one of the more basic interview questions, it can be deceptively hard to answer. This question helps to separate out candidates who know just the fact of .NET multi-language support, from the ones who understand and can articulate the how (and why). A strong response to this question might be: “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.”

2. What are the advantages and disadvantages of user controls and custom controls?

This 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.

3. 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 interview question is of an applied technical nature for the ASP.NET developer, since it demands familiarity with the entire ASP.NET 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.

We can help you with your next hire:

4. 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 a potential candidate may not have worked with the latest version of IIS at a previous position. This interview question helps to ensure your top candidate has either experience working with the IIS version you use or enough familiarity with similar ones to make the transition.

5. How do you prevent CSRF attacks?

Interview questions such as this will tell you about your ASP.NET candidates’ experience with real-world applications and their awareness of security issues. A Cross-Site Request Forgery 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 that the request is genuine. If desired, you can follow this up with further interview questions about how ASP.NET deals with other security issues.

6. 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. Follow-up interview questions could involve asking about this difference, with the main advantage of ASP.NET MVC over ASP.NET Web Forms being that each part can be tested separately, without the need to load the entire application, allowing for speedy test-driven development.

7. 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 this interview question. 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 ASP.NET candidates should be able to talk through their chosen solution and explain how it works. The answer to this interview question gives you insight into their understanding of the framework and approach to application building.

8. What is the difference between Stateful and Stateless?

This interview question 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 interview questions balance an assessment of acumen with the ASP.NET developer candidates’ understanding of the framework. You could also ask about past projects that they’re particularly proud of, or the kinds of work they would like to do going forward. Their responses to these questions help you gain insight into how they approach their ASP.NET coding career. In turn, you get to show them that you’re committed to combining the candidate’s goals with your company’s objectives.

This post has been updated to reflect more current information.

More From the Blog...

Availability Status

Let us know you're ready to work with one click.

Update My Status

Set Your Status

Click the blue button on your profile page at least once a week to keep your status set to Available.

Set Your Status

Your status will automatically change to Idle and Unknown over time, so update it weekly while you’re looking for work

Update My Status