All subjects.NET · 38 questions · 8 junior / 24 mid / 6 senior

ASP.NET Web Forms quiz and interview questions

Many companies still run Web Forms applications and need developers who can maintain and modernise them. Interviews focus on ViewState, postbacks, the page life cycle and state management — and on how you'd move an app to ASP.NET Core.

ASP.NET Web Forms quiz38 questions in the bank · 10 per round
Level
Question type
Mode

ASP.NET Web Forms: key concepts

Postback
The page's form posts back to the same page, and server-side event handlers (Button_Click) run. Check IsPostBack to run first-load code once.
ViewState
Control state stored in a hidden field and sent back with each postback. Convenient, but it can make pages heavy.
Page life cycle
Init → Load → control events → PreRender → Render → Unload. Knowing the order explains many "why is my value empty" bugs.
State management
ViewState (per page), Session (per user, server side), cookies (client side), Application/cache (shared).
Master pages and user controls
Master pages give a shared layout; user controls (.ascx) are reusable page pieces.
Modernising
Web Forms runs only on .NET Framework (Windows). New work usually moves to ASP.NET Core MVC, Razor Pages or Blazor.

All 38 ASP.NET Web Forms questions with answers

Try each one first, then open the answer. Making a class test? Use the test maker.

  1. juniorConcepts

    What is a postback in Web Forms?

    • A. A redirect to another site
    • B. The page posting its form back to itself so server events can run
    • C. A database rollback
    • D. An email reply
    Show answer

    B. The page posting its form back to itself so server events can run — Clicking an <asp:Button> posts the page back and runs its Click handler on the server.

  2. midConcepts

    What is ViewState?

    • A. A CSS feature
    • B. Control values kept in a hidden form field across postbacks
    • C. Server memory per user
    • D. A browser cache
    Show answer

    B. Control values kept in a hidden form field across postbacks — It lets a TextBox keep its value after a postback without you writing code — at the cost of page size.

  3. midPredict the output

    When does BindGrid() run?

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindGrid();
        }
    }
    • A. On every request
    • B. Only on the first load, not on postbacks
    • C. Only on postbacks
    • D. Never
    Show answer

    B. Only on the first load, not on postbacks — IsPostBack is false on the first GET and true on postbacks, so the grid is bound once and kept by ViewState.

  4. midConcepts

    Which page life-cycle event runs first?

    • A. Load
    • B. PreRender
    • C. Init
    • D. Render
    Show answer

    C. Init — Init → Load → control events → PreRender → Render → Unload.

  5. midConcepts

    What is the difference between Server.Transfer and Response.Redirect?

    • A. None
    • B. Transfer switches pages on the server (URL doesn't change); Redirect tells the browser to request a new URL
    • C. Redirect is server-side
    • D. Transfer works across websites
    Show answer

    B. Transfer switches pages on the server (URL doesn't change); Redirect tells the browser to request a new URL — Redirect costs a round-trip but shows the right URL; Transfer is faster but the address bar keeps the old URL.

  6. juniorConcepts

    What is a master page?

    • A. The home page
    • B. A shared layout (header, menu, footer) that content pages plug into
    • C. An admin page
    • D. A database page
    Show answer

    B. A shared layout (header, menu, footer) that content pages plug into — Content pages fill the master page's ContentPlaceHolder controls.

  7. midConcepts

    What is a user control (.ascx)?

    • A. A login form
    • B. A reusable piece of UI you can drop into several pages
    • C. A type of ViewState
    • D. A web service
    Show answer

    B. A reusable piece of UI you can drop into several pages — E.g. an address-entry block used on checkout and profile pages.

  8. seniorConcepts

    Pages are slow and the HTML is huge. What Web Forms feature should you check first?

    • A. Master pages
    • B. ViewState — disable it on controls that don't need it
    • C. Session state
    • D. Cookies
    Show answer

    B. ViewState — disable it on controls that don't need it — Large grids with ViewState enabled can add hundreds of KB to every request and response.

  9. midConcepts

    Where is Session state stored by default?

    • A. In the browser
    • B. On the server, per user
    • C. In ViewState
    • D. In the URL
    Show answer

    B. On the server, per user — Session data lives on the server (in-process by default); only a session ID cookie goes to the browser.

  10. juniorConcepts

    Which control makes a field mandatory without writing code?

    • A. RangeValidator
    • B. RequiredFieldValidator
    • C. Label
    • D. Panel
    Show answer

    B. RequiredFieldValidator — Validation controls run in the browser and on the server; check Page.IsValid in your handler.

More subjects

Need software for your business instead? I'm an AI automation & full-stack developer — see what I build.

Chat on WhatsApp