Lesson No. 5 ASP.NET (Using Visual Basic.NET)
For IT Online MOCK EXAM   link 1 link 2
For IT Online MOCK EXAM   link 1 link 2

Lesson Summary

Web Application
Web Application is an application that uses a web browser as a client.

In a Client-Server environment –

Client is used to run the application and accepts information.

Server application is used to store, retrieve and process the information.

Web applications uses combination of sever-side script languages and client-side script languages to develop the application.


  • Online Word Processor
  • Online Image Processing applications
  • Web base email clients like Gmail, Yahoo, MSN, etc..
  • Google Apps, Microsoft Office Live, WebEx, Web Office, etc.

It is a software technology that is accessible with latest Microsoft Windows Operating System.
It is Microsoft's Managed Code programming model for building applications on Windows Clients, Servers and mobile or embedded devices.
For Windows 2003 and above the .NET Framework is installed automatically as a part of the operating system. 
.NET Framework is a platform that provides tools and technologies needed to build Networked Applications, Distributed Web Services and Web Applications.
.NET Framework is based on object oriented programming environment. 
It is the technology for building dynamic Web applications. 
It is an important Windows component that supports developing and executing the next generation of applications and XML Web services.

CLS (Common Language Specifications)
Common Language Specification (CLS) is a set of basic language features that .Net Languages needed to develop Applications and Services, which are supported by the CLR.

The main two components of .Net Framework are Common Language Runtime (CLR) and .Net Framework Class Library (FCL).

CLR (Common Language Run-time)

The Common Language Runtime (CLR) is a run-time Execution Environment which runs the code and provides services that make the development process faster.

The main function of Common Language Runtime (CLR) is to convert the Managed Code into native code and then execute the Program.
It works as a layer between Operating Systems and the applications written in .NET languages that confirms to the CLS. 
The runtime automatically handles object layout and manages objects and replaces them when they are no longer being used.

FCL (.NET Framework Class Library)

It is a large collection of predefined classes, interfaces, and value types that expedite and optimize the development process and provide access to system functionality.

Namespaces allows organizing classes, so that they can be easily accessed in other applications. 
Namespaces are the names which do not represent location.
It enable to avoid any naming conflicts between classes that have the same name.

E.g. System.IO, Microsoft.Win32, System, Sytem.Web, System.Web.UI.WebControls

An assembly is a collection of types and resources that forms a logical unit of functionality.
Assembly is stored as an .exe  or .dll file.

It is a technology for building powerful, dynamic web aplications.

It is an extension version of Active Server Pages(ASP)

ASP.NET is a pre-compiled.

ASP.Net is designed to work with the HTTP protocol. This is the standard protocol used across all web applications.

ASP.Net applications can also be written in a variety of .Net languages. These include C#, VB.Net and J#.

.NET Programming Languages
Languages provided by Microsoft
Visual Basic.NET, C#, Visual C++, Visual J#,  JScript

ASP.NET Server Technologies
Web Pages (with Razor syntax)
MVC (Model View Controller)
Web Forms (traditional ASP.NET)

ASP.NET Development Tools
Visual Web Developer

Visual Studio.NET

ASP.NET files have the extension  .aspx
ASP.NET pages contain directives that allows specifying page properties & configuration information for the page.
The directives are used by ASP.NET as instructions for how to process the page, but they are not rendered as part of the markup that is sent to the browser.
Application directives specify optional application-specific settings used by the ASP.NET parser when processing. 

@ Page directive - defines page-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .aspxfiles.

Attributes of @Page directive: Buffer, ClassName, CodeBehing, Src, Title, ValidateRequest, etc

View State persists values in a page.

Code-declaration blocks
Language attribute specifies language used in code declaration block.
The  runat attribute specifies that the code contained in script block runs on the server. 
The src attribute specifies path and file name of an external script file to load.
<script runat="server" language="VB" src="filepath".


Visual Studio.NET
The Visual Studio is the tool used for desing, develop, debug and develop Web applications and traditional client applications.
Every Visual Basic project has a project file with an extension of vbproj.

Parts of Visual Studio window:
Server Explorer
It is tool that is shared across development languages and projects. It is used to connect server as well as view and and access its resources.

Solution Explorer
It provides an organized view of the projects and their files.

Class View
It displays the symbols defined, referenced or called in the application for developing. The Class View toolbar allows to add virtual folders and to navigate within the objects and member panes.

Properties Window
It is used to view and change the design-time properties and events of selected objects  from web form to editors and designers. It is alos used to edit and view file, project, and solution properties.

Document and Outline View
To view the logical structure of document, to determine which elements are HTML elements and which ones are Web server controls.
Navigate to specific elements in Desing view and in Source view.

Object Browser
It allows to select and examine the symbols available which are  used in the projects.

Code Editor
The Visual Studio.NET Code editor is also known as the Text Editor.

Design View
The Design view displays ASP.NET Web pages, master pages, content pages, HTML pages and user controls using a near WYSIWYG view.

Source View
The Source view displays the HTML markup for the Web page, which can be edited. 

Control Class
The Control Class implements very basic functionality required by classes that display information to the user. IT handles  user input through the keyboard and pointing devices. Control Class handles message routing and security.

ASP.NET Controls
ASP.NET Web Server Controls
Web Server Controls are objects on ASP.NET web pages that run when the page is requested and render markup to a browser. 

It contains classes that are rendered as HTML tags, such as the TextBox control and the ListBox control.
The WebControl class serves as the base class for many of the classes in the System.Web.UI.WebControls namespace.

Introduction and use of different Controls
Text Box - control displays a textbox for user input.
Label - control displays a text on a web page.
Image - control displays image on a web page.
DropDownList - control allows the user to select a single item from a drop down list.
CheckBox - control displays a checkbox that allows the user to select a true or false condition.
CheckBoxList - control creates multi selection check box group.
RadioButton - control displays radio button.
HyperLink - control displays a link to another web page.
HiddenField - represents a hidden field used to store a non-displayed value.

HTML Server Controls
The System.Web.UI.WebControls namespace contains classes that allow you to create HTML server controls on a Web Forms page. HTML Server controls run on the server and map directly to standard HTML tags supported by most browsers.

HtmlAnchor - control used to programatically control an <a> html element.
HtmlButton - control used to programatically control as the html <button> element. 
HtmlForm - control used as same the HTML <form> element.
HtmlImage - control used as HTML <img> element.
HtmlInputButton - control used as HTML <input type=button> element.
HtmlInputCheckBox - control used as HTML <input type-checkbox> element.
HtmlInputFile - control used as HTML <input type=file> element. 
HtmlInputHidden - control used as HTML <input type=hidden> element.
HtmlInputRadioButton - control used as HTML <input type=radio> element.
HtmlInputText - control to run server code against the <input type=text> and <input type=password> HTML elements.
HtmlSelect - control is same as the HTML <select> element.
HtmlTextArea - control is same as the HTML <textarea> element. It allow multiline text box. Cols property determines the width and Rows property determines the height.

Validation is the testing process to determine whether value entered by visitor inot field is valid or not.
Validation Server Controls
ASP.NET provides Validaton Server controls to compare user input in different fields or against values that might be held in other controls, such as textbox, database etc. 
Namespace - System.Web.UI.WebControls
Assembly - System.Web (in System.Web.dll)
CompareValidator - allows for comparisons between the user's input and another item using a comparison operator(equals, greater than, less than, and so on)

RangeValidator - checks the user's input based upon a lower and upper-level range of numbers or characters.

Components and Applications
The System.Web namespace supplies classes and interfaces that enable browser-server communication. 
It includes the HttpRequest class which provides extensive information about the current HTTP request, the HttpResponse class, which manages HTTP output to the client. 

- manages HTTP output to the client.
Cookies - gets the response cookie collection, contains new cookies created on the server and transmitted to the client in the Set-Cookie header.

Method :
BinaryWrite - Writes a string of binary characters to the HTTP output stream.
Clear - Clears all content output from the buffer stream.
End  - Sends all currently buffered output to the client,
Flush - Sends all currently buffered output to the client.
Write - Writes a string to an HTTP response output stream.

HttpRequest enables ASP.NET to read and the HTTP values sent by a client during a Web request.
The query string and fields on an HTML form that are available from an HTTP request.

Browser - Gets or sets information about the requesting client's browser capabilities.
Cookies - Gets a collection of cookies sent by the client.
- contains cookies transmitted by the client to the server in the Cookie header.

SeverVariables - Gets a collection of Web Server variables.
HTTP_COOKIE - Returns the cookie string that was included with the request.
HTTP_HOST - Returns the name of the Web Sever.
HTTP_METHOD - Returns the method used to make the request.
HTTP_URL - Returns the encoded URL
HTTP_USER_AGENT - Returns a string describing the browser that sent the request.
HTTP_VERSION - Returns the name and version of request protocol.
REMOTE_ADDR - Retruns the IP Address of the remote host making request.
REMOTE_USER - Returns the name of the host making request.
REQUEST_METHOD - USed to make the request, this can be Get, head, post, and so on
SERVER_NAME - Returns the Server name.
SERVER_PORT - Returns the Server port number to which the request was sent.

ToString - It converts an object to its string representation.
ValidateInput - It sets flags so that when they get accesses for the Cookies, Form, or Query String. It checks all input data against a hard-coded list of potentially dangerous data.

Application and State Management
Application state is a data storage area available to all classes in an ASP.NET application.
stores variables that can be accessed by all users of an ASP.NET application.
Application state is stored in an instance of the HttpApplicationState class.

The HttpApplicationState class is most often accessed through the Application property of the Http Context class.

By default, ASP.NET session state is enabled for all ASP.NET applications.

The Global.asax file also known as the ASP.NET application file, is an optional file that contains code for responiding to application-level and session-level events raised by ASP.NET or by HTTP modules.

The Global.asax file resides in the reoot directory of an ASP.NET application.
The Global.asax file is optional. Yo create it only if you want to handle Application_Start, Application_Eng, Session_Start and Session_Eng events. 

@Application difective can be used only in Global.asax files, while the other directives are used in other ASP.NET files such as Web pages (.aspx files) and user controls (.asex files)
Application directives specify optional application-specific settings used by the ASP.NET parser when processing.

A cookie is a small bit of text or small amount of data that is stored either in a text file on the client files system or in-memory in the client browser session.
The cookie contians information the Web application can read whenever the user visits the site. 
Cookies can be temporary (with specific expiration times and dates) or persistent.
The cookies is used to store information about a particular client, session or application. 

Short Questions:
  • Explain the basic principle of ASP.NET
  • What is CLR?
  • Define CLS
  • Define FCL
  • Explain Advantages of ASP.NET
  • Explain difference in the processing of single-file pages and Code-behind  - Ans. Page No. 113 of text book
  • Define Web Server Controls
  • Define Html Server Controls
  • Define the method flush() and write(string) opf Http response class
  • Define the method Clear and End
  • Explain Server variables in ASP.NET.

Importance of Lesson No. 5 in Exam

Online Exam   (Weight-age: 14  to 16 marks)

  • MCQ1 Select one Answer - 3 to 5 questions
  • Fill in the blanks -  1 or 2 questions
  • True or False - 1 or 2 questions
  • Short/Long Answers  -  1 question 
  • MCQ2 Select two Answers   - 1 question   (may come)
  • MCQ3 Select three Answers -  1 question  (may come)
  • Rearrange the following - 1 question (may come)

For Objective Questions Practice LINK 1 LINK 2

For Appearing an IT TEST  link 1 link 2





  1. Can you please upload question wise scope of this chapter and also of chapters 4 and 6?

  2. Visit http://exza.in

    Since ITOnlineExam.com not working due to Bandwidth limit got exceeded yesterday....

  3. https://itonlineexam.com/mocklogin.php

    Visit for HSC Online IT exam Practice.