Preparing for a Classic ASP.NET Interview
Interviews for roles maintaining legacy Web Forms systems tend to probe three areas: deep understanding of the page lifecycle and ViewState mechanics (since these cause the hardest bugs), practical data-binding and control knowledge (GridView, Repeater, validation controls), and awareness of the platform's limitations that motivate eventual migration. Strong candidates can explain not just what the page lifecycle stages are, but why a specific bug happens given a lifecycle-ordering mistake, and can articulate trade-offs like when SqlDataSource is acceptable versus when a repository pattern is warranted.
Cricket analogy: A cricket selector doesn't just ask a bowler what deliveries they know, they probe why a particular field placement worked against a specific batsman, similar to interviewers probing why a lifecycle bug happens, not just naming the stages.
Lifecycle and ViewState Deep-Dive Questions
Common lifecycle questions include explaining the order of events for both an initial GET and a subsequent postback (Init, Load, control postback events like Click, then PreRender, then Render), and explaining why control events fire after Page_Load but before Page_PreRender — a distinction that matters because code depending on a Click handler's side effects should run after it, not assume it already ran during Load. ViewState questions typically ask how it is stored (Base64-encoded, optionally MAC-signed and encrypted, in a hidden __VIEWSTATE field), how EnableViewState cascades from Page down to individual controls, and what the practical difference is between ViewState and ControlState (ControlState cannot be disabled and is meant for essential control-internal data like GridView's current page index).
Cricket analogy: Explaining the correct batting order and when a declaration should be called requires knowing the exact sequence of an innings, similar to explaining the exact sequence of Init, Load, postback events, and PreRender in the page lifecycle.
// Typical interview question: "What's wrong with this code?"
protected void Page_Load(object sender, EventArgs e)
{
GridView1.DataSource = GetProducts();
GridView1.DataBind(); // Missing IsPostBack check — rebinds every time
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
// Runs AFTER Page_Load on postback, so GridView1 was already rebound
// above before this handler even executes — selection/edit state is lost
}Practical and Scenario-Based Questions
Interviewers often present a scenario rather than asking for a definition: "A GridView loses its selected row after paging — what's the most likely cause and fix?" (Likely cause: rebinding unconditionally in Page_Load instead of guarding with IsPostBack, or not persisting SelectedIndex across the page state correctly.) Another frequent scenario question covers validation controls: explaining the difference between client-side validation (a RequiredFieldValidator emitting JavaScript via WebUIValidation.js) and the mandatory server-side re-check via Page.IsValid, and why relying on client-side validation alone is insecure since a request can bypass the browser entirely.
Cricket analogy: A coach presenting a match scenario — "three wickets down, ten overs left, target 80" — and asking for the right batting approach tests applied judgment, similar to interviewers presenting a GridView bug scenario instead of asking for rote definitions.
Practicing out loud with real scenario questions (not just flashcards of definitions) is the highest-leverage prep for these interviews, since interviewers are testing whether a candidate can diagnose the specific class of bugs Web Forms produces, not whether they can recite ASP.NET terminology.
- Interviewers probe reasoning about lifecycle bugs and trade-offs, not just recall of terminology.
- Know the exact event order for both initial GET and postback requests, including where control events fall relative to Load and PreRender.
- Understand ViewState's storage format (Base64, optional encryption/MAC) and how it differs from ControlState.
- Be ready to diagnose scenario-based bugs like a GridView losing its selected row after paging.
- Explain why server-side validation via Page.IsValid is mandatory even when client-side validators are present.
- Be able to justify when SqlDataSource is acceptable versus when a repository pattern is warranted.
- Practicing applied scenario questions is more valuable prep than memorizing lifecycle stage names alone.
Practice what you learned
1. In the ASP.NET Web Forms page lifecycle, when do control postback events (like a Button's Click) fire relative to Page_Load and Page_PreRender?
2. What is the key difference between ViewState and ControlState?
3. A GridView loses its selected row after paging. What is the most likely root cause an interviewer expects?
4. Why is relying solely on client-side validation (RequiredFieldValidator's JavaScript) insecure?
5. How is ViewState fundamentally stored and transmitted?
Was this page helpful?
You May Also Like
Common Web Forms Pitfalls
The recurring lifecycle, ViewState, and event-handling mistakes that trip up developers working with classic ASP.NET Web Forms.
Web Forms Best Practices
Practical guidelines for writing maintainable, secure, and performant ASP.NET Web Forms applications, from ViewState discipline to layered code organization.
Classic ASP.NET Quick Reference
A condensed reference for the Web Forms page lifecycle, common controls, directives, and web.config settings.
Related Reading
Related Study Notes in Microsoft Technologies
Browse all study notesWindows 10 / UWP Development Study Notes
.NET · 30 topics
Microsoft TechnologiesWindows Batch Scripting Study Notes
Batch · 30 topics
Microsoft TechnologiesMFC (Microsoft Foundation Classes) Study Notes
C++ · 30 topics
Microsoft TechnologiesSilverlight Study Notes
.NET · 30 topics
Microsoft TechnologiesXAML Study Notes
.NET · 30 topics
Microsoft TechnologiesWPF (Windows Presentation Foundation) Study Notes
.NET · 30 topics