Introduction to ASP.NET


  • ASP.NET provides a true language-neutral execution framework for Web applications to use. This provides language independence as long as the language is supported by NGWS framework. This means weather you use C#, VB, JScript or Perl your code will be converted to Intermediate Language and then executed by NGWS framework.
  • ASP.NET allows true separation of code and content. With ASP.NET you can place your code and HTML in separate files thus making maintenance easier.
  • The new ASP.NET server controls provide nice way to minimize the amount of code you write
  • ASP.NET Web Services makes it much easier to tailor your pages to suit a specific device.
  • ASP.NET files are stored with .aspx extension rather than .asp. Older .asp files are still valid but can not take advantages of new features.
  • ASP.NET server controls are capable of maintaining their state i.e. programmer need not keep track of values entered by the user in form controls while redisplaying the same form
  • ASP.NET also provides some advanced controls like datagrid, datalist , repeater and calendar which provide rich functionality and saves programmer from lot of code.
  • All the ASP.NET server controls are compatible with HTML3.2 and above browsers which means you need not write separate code for different browsers.

ASP.NET and Scripting Languages

  • ASP.NET uses compiled languages rather that scripting languages. For example VB C#, JScript and Perl.
  • You can use only one language per page
  • If you want mix two languages you have to use pagelets. Pagelets are miniature ASP.NET pages that can be embedded in other pages.
  • Functions must be inside a <SCRIPT> block rather than <% and %> block

Types of ASP.NET controls

  • HTML controls : They represent standard HTML controls but run at server end.
  • WebControls : ASP.NET  offers a set of controls which map closely to standard HTML controls but provide consistent properties, methods and events. Some WebControls  like data grid provide advance features which are not available with standard HTML controls

The common HTML controls

  • <table>
  • <tr>
  • <td>
  • <form>
  • <input>
  • <select>
  • <textarea>
  • <button>
  • <a>
  • <img>

The common Web Controls

  • <asp:Button>
  • <asp:TextBox>
  • <asp:CheckBox>
  • <asp:RadioButton>
  • <asp:DropDownList>
  • <asp:ListBox>
  • <asp:Label>
  • <asp:Panel>
  • <asp:Table>
  • <asp:TableRow>
  • <asp:TableCell>
  • <asp:Image>
  • <asp:HyperLink>
  • <asp:Repeater>
  • <asp:Calendar>

There are also some advance controls like Input validation controls and data bound grid which we will see later.

Advantages of  Server side Controls

  • Your code structure becomes clean and more readable
  • Separation of processing code and display code is possible
  • To access the values of the controls you no longer need to use Request collection, you can refer to the control by its id directly
  • The problem of state maintenance is automatically taken care by ASP.NET

Making control run at server

To process HTML or Web control you need to add runat="server" attribute the control definition.


<input type="text" id="text1" runat="server">

<asp:TextBox id="text1" runat="server />

How ASP.NET maintains state?

ASP.NET uses hidden fields to maintain state of your controls. Hidden fields are used to store values entered by the user into the form controls. There are some points which you should note about state maintenance :

  • Your FORM must run at server i.e. you must set runat attribute of FORM element to "server"
  • You must use POST method. This is because if you use GET the data will be passed as query string.

Server-side Event Processing

Server side controls have events that are processed at server end. Here again you set the runat attribute of SCRIPT element to "server". The server side events have different naming convention to separate them from client side events. Each event is of the form OnServer<event> e.g. OnSeverClick

<SCRIPT language="VB" runat="server">
Sub MyProc(sender as object,evt as EventArgs)
text1.value = "Hello From ASP.NET"
End Sub

<INPUT type="text" value="" runat="server" id="text1>
<INPUT type="submit" value="Submit" runat="server" onserverclick="MyProc">


We saw what ASP.NET is and how it is significantly different than earlier versions of ASP. The features like web controls, true data type support, full VB language support, code separation, compiled execution are some of the key features of ASP.NET. These features make ASP.NET easy to use and more programmer friendly than ever before.

Bipin Joshi is an independent software consultant, trainer, author, and meditation teacher. He has been programming, meditating, and teaching for 25+ years. He conducts instructor-led online training courses in ASP.NET family of technologies for individuals and small groups. He is a published author and has authored or co-authored books for Apress and Wrox press. Having embraced the Yoga way of life he also teaches Ajapa Yoga to interested individuals. To know more about him click here.

Get connected : Facebook  Twitter  LinkedIn  YouTube

Posted On : 18 December 2000

Tags : ASP.NET Web Forms .NET Framework