Making a Page Dynamic with Code Blocks

The pages we created in the previous section are static, meaning that the content is fixed. It doesn’t matter how many times you request the URLs associated with those files, the content returned to the browser will always be the same. The ASP.NET server treats static content as opaque, meaning that it doesn’t look inside the files or process them, except to return their contents to the client browser.

The counterpart to a static web page is a dynamic web page, which mixes HTML content with program logic that the ASP.NET server executes to generate content. The HTML that results from a request to a dynamic page can vary based on the output of the program logic. In this section, we will convert our HTML file ...

Get Applied ASP.NET 4 in Context now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.