WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

ASP.NET Web Forms - HTML Pages


A straightforward ASP.NET page looks simply like a standard HTML page.


Hello welookups

To begin learning ASP.NET, we will build a straightforward HTML page that will show "Hello welookups" in an Internet program like this:

Hello welookups!

 

 


Hello welookups in HTML

This code shows the model as a HTML page:

<html>
<body bgcolor="yellow">
<center>
<h2>Hello welookups!</h2>
</center>
</body>
</html>

If you need to attempt it yourself, spare the code in a document called "firstpage.htm", and make a connection to the document this way: firstpage.htm


Hello welookups in ASP.NET

The least difficult approach to change over a HTML page into an ASP.NET page is to duplicate the HTML record to another document with a .aspx extension.

This code shows our precedent as an ASP.NET page:

<html>
<body bgcolor="yellow">
<center>
<h2>Hello welookups!</h2>
</center>
</body>
</html>

If you need to attempt it yourself, spare the code in a document called "firstpage.aspx", and make a connection to the document like this: firstpage.aspx


How Does it Work?

Fundamentally an ASP.NET page is only equivalent to a HTML page.

An HTML page has the augmentation .htm. In the event that a program asks for a HTML page from the server, the server sends the page to the program with no modifications.

An ASP.NET page has the expansion .aspx. In the event that a program asks for an ASP.NET page, the server forms any executable code in the page, before the outcome is sent back to the browser.

The ASP.NET page above does not contain any executable code, so nothing is executed. In the following precedents we will add some executable code to the page to show the distinction between static HTML pages and dynamic ASP pages.


Classic ASP

Active Server Pages (ASP) has been around for quite a while. With ASP, executable code can be put inside HTML pages.

Previous forms of ASP (before ASP .NET) are frequently called Classic ASP.

ASP.NET isn't completely perfect with Classic ASP, yet most Classic ASP pages will work fine as ASP.NET pages, with just minor changes.

If you need to study Classic ASP, if you don't mind visit our ASP Tutorial.


Dynamic Page in Classic ASP

To exhibit how ASP can show pages with dynamic substance, we have included some executable code (in red) to the past example:

<html>
<body bgcolor="yellow">
<center>
<h2>Hello welookups!</h2>
<p><%Response.Write(Now())%></p>
</center>
</body>
</html>

The code inside the <% - %> labels is executed on the server.

Response.Write is ASP code for composing something to the HTML yield stream.

Now() is a capacity restoring the servers current date and time.

If you need to attempt it yourself, spare the code in a document called "dynpage.asp", and make a connection to the document this way: dynpage.asp


Dynamic Page in ASP .NET

This following code shows our model as an ASP.NET page:

<html>
<body bgcolor="yellow">
<center>
<h2>Hello welookups!</h2>
<p><%Response.Write(Now())%></p>
</center>
</body>
</html>

If you need to attempt it yourself, spare the code in a document called "dynpage.aspx", and make a connection to the document this way: dynpage.aspx


ASP.NET versus Classic ASP

The past models didn't show any contrasts among ASP.NET and Classic ASP.

As you can see from the two most recent models there are no contrasts between the two ASP and ASP.NET pages.

In the following parts you will perceive how server controls make ASP.NET more dominant than Classic ASP.