To explain how ASP.NET works you first have to understand how HTML works, which is called client-side scripting. Client-side means your browser and the machine running the browser, i.e. your PC. This is opposed to Server-side where the web server is running.
Client-side scripting works like this:
You choose a link to a .html or .htm in your browser.
The web server locates the page and sends it back to your browser.
Your browser interprets the HTML tags and, at the same time, executes any client-side scripting code it encounters.
Some code isn't executed immediately as it waits until you do something like click a button.
An ASP.NET page works like this:
You click on a link to a .aspx page in your browser.
The server locates the page and recognizes it as a .aspx page.
The server checks to see if it has a compiled version of the page, if not, it will compile the file.
The server executes the compiled verison of the page, running the source-code parts of the page and sending the HTML parts of the page to your browser. None of the source-code is sent; only the pure HTML is returned to your browser.
The server save the compiled version of the page for use next time the page is requested.
The advantages of ASP.NET are:
.aspx pages are easier to write as the source-code and HTML-code are in the same file.
The pages are more powerful due to the souce-code being executed on the server.
Execution is faster as the page is only compiled once.
Because only the pure HTML is sent back to your browser the .aspx page works with any browser running on any computer!