Friday, 11 September 2015

Easy To Learn Html Simple Pages

Html Simple Pages:

Simple ASP>NET page looks same as ordinary html page.

Hello Html Lovers:

We will construct very simple Html page that display "Hello Html Lovers" in an browser to start learning ASP.NET like this:

Hello Html Lovers In Html:

These codes will display examples as html page

If you want to try save code file called "firstpage.htm".

Hello Html Lover In ASP.NET:

Simplest way to convert Html page into ASP.Net page is to copy html file to new file with .aspx extension.
This example display ASP.NET page:

How Its Work?

ASP.NET page is same as Html page.
Html page has extension .htm.Server sends pageto browser without any modifications,If browser requests Html page from server.
ASP.NET page has extension .aspx. server processes any executable code in page,before result is sent back to browser,If browser requests an ASP.NET page.
ASP.NET page above does not contain any executable code,so nothing is executed.Next examples we will add more codes to demonstrate diffrence b/w static html pages and dynamic ASP pages.

Classic ASP:

(ASP) Active Server Pages has been around for several years.Executable code can be placed inside html pages by using ASP.
Classic ASP is previous version of ASP(before ASP.NET).
ASP.NET is not fully compatible with Classic ASP but most classic asp pages will work fine as ASP.NET pages with only little changes.

Dynamic Page in Classic ASP:

In order to demonstrate that How ASP can display pages with dynamc content,now I have added some executable code to previous example:

Code inside <%--%> tags are exeuted on server.
Response.Write ASP code for writing something to Html output stream.
Now () is function returning servers current date and time.
If you want to try it save code in file called "dynpage.asp" .

Dynamic Page:

Following code will display our example as ASP.NET page.

Classic ASP vs ASP.NET:

Previous examples does not show any difference b/w ASP.NET and Classic ASP.
From latest two examples there is no difference b/w two ASP and ASP.NET pages.
In further discussion you will see how server controls make ASP.NET more powerful Than Classic ASP.

Classic ASP Limitations:

Listing below is copied from previous examples:

Code above  illustrate limitation in Classic ASP:COde block has to be placed where you want output to appear.
It is impossible to seperate executable code from Html itself,With Classic  ASP.This make page difficult to maintain and read.

Server Controls - ASP.NET:

"spaghetti-code" problem has been solved by ASP.NET that describes above servers controls.
Server controls tags are tags that are understood by server.
Following are three kinds of server controls:
1)WEB SERVER CONTROLS - New ASP.NET tags
2)VALIDATION SERVER CONTROLS - For input validation
3)HTML SERVER CONTROLS - Traditional Html Tags

No comments:

Post a Comment