Download - Designing online exam in ASP.NET
1. SYNOPSIS
The title of the project is”Online Examination”. This is an Online IQ Testing
website constructed using ASP.NET. The project is a free server. The goal of the project
is to make a person to evaluate his IQ skill by himself through internet. And there by the
user can increases his IQ ability. The person may be at any place and can access and
evaluate himself on his IQ and increases his general knowledge by browsing through
internet.
The project provides user an individual account. Whenever the user sign-in to
i-Skill and enters ‘New Test’ a set of twenty five objective type questions are displayed
to the user. The user has to select the answer by just clicking on it. And when he clicks on
End his answers are evaluated and the result is displayed to the user.
Signup is also given for new user and several navigation options are provided in
this project. The result of one user is hidden to the other users by providing a unique user
name on user choice and password to access his account. So the user can overcome up
with his shy and thus he can improve his knowledge.
1
2. INTRODUCTION
ASP.NET is web service software, (i.e.) software used for website and web
application development. A Web service Software is as “a software system designed to
support interoperable Machine to Machine interaction over a network”. Web services are
frequently just Web APIs that can be accessed over a network, such as the Internet, and
executed on a remote system hosting the requested services.
The web service definition encompasses many different systems, but in common
usage the term refers to clients and servers that communicate using XML messages. In
such systems, there is often machine-readable description of the operations offered by the
service written in the Web Service written in the Web Services Description Language
(WSDL).
The web service is used in many development applications like communication
systems and xml database systems.
2
3. SYSTEM DESIGN
3.1 Hardware Requirements
Processor : Intel Pentium4
Processor frequency : 1.8 GHz
Hard disk free space : 3 GB
Memory : 256 MB RAM
Monitor : 15” Standard Colour Monitor
Mouse : Windows Compatible Scrolling mouse
Keyboard : Windows Compatible 104 keys
3.2 Software Requirements
Operating System : Microsoft Windows XP SP2
Software Packages : .Net Framework 2.0
Front End : ASP .NET
Back End : Microsoft SQL Server 2000
3
4. ABOUT THE SOFTWARE
4.1 ASP.NET
ASP.NET is a set of web application development technologies marketed by
Microsoft. Programmers can use it to build dynamic web sites, web applications and
XML web services. It is a part of Microsoft’s .NET platform and is the successor to
Microsoft’s Active Server Pages (ASP) technology.
ASP.NET is built on the Common Language Runtime, meaning programmers can
write ASP.NET code using any Microsoft .NET language.
ASPX is a text file format used to create Webform pages; in programming jargon,
the ASPX file typically contains static HTML or XHTML markup, as well as markup
defining Web Controls and Web User Controls where the developer places all the
required static and dynamic content for the web page. Additionally, dynamic code which
runs on the server can be placed in a page within a block <% -- dynamic code -- %>
which is similar to the other web development technologies such as PHP, JSP, and ASP,
but this practice is generally discouraged except for Databinding.
The recommended method for dealing with dynamic program code is to use the
code-behind model, which places this code in a separate file or in a specially designated
script tag. Code-behind files are typically named something to the effect of
MyPage.aspx.cs or Mypage.aspx.vb based on the ASPX file name (this practice is
automatic in Microsoft Visual Studio and other IDEs). When using this style of
programming, the developer writes code to respond to different events, like the page
being loaded, or a control being clicked, rather than a procedural walk through the
document.
4
ASP.NET supports a wide variety of files. The files associated with different
versions of ASP.NET are as follows.
asax - Global.asax, used for application-level and event handling.
ascx – Web User Controls: custom controls to be placed onto web pages.
ashx – custom HTTP handlers.
asmx – web service pages.
axd – When enabled in web.config requesting trace.axd outputs application-level
tracing.
browser– browser capabilities files stored in XML format; introduced in
version3.0. ASP.NET 2 includes many of these by default, to support common
web browsers. These specify which browsers have which capabilities, so that
ASP.NET 2 can automatically customize and optimize its output accordingly.
Special browser files are available for free download to handle, for instance, the
W3C validator, so that it properly shows standards-compliant pages as being
standards-compliant. Replaces the harder-to-use BrowserCaps section that was in
machine.config and could be overridden in web.config in ASP.NET 1.x.
Config – web.config is the only file in a specific Web application to use this
extension by default (machine.config similarly affects the entire Web Server and
all applications on it), however ASP.NET provides facilities to create and
consume other config files. These are stored in XML format, so as to allow
configuration changes to be made with simplicity.
cs – In asp.NET 2 any cs files placed inside the AppCode folder are dynamically
compiled and available to the whole application.
Master – Master Pages; introduced in version 2.0. Using this one can design a
consistent layout for the pages of his/her website. Once master page is defined
with how it looks and feel then all other page is applied with that layout.
Theme and skins – With the themes and skins one can easily manipulate the looks
of his/her website. The user needs to define the style at a specific location and this
style is applied globally to all the pages in that website.
5
PERFORMANCE
ASP.NET aims for performance benefits over other script-based technologies
(including ASP Classic) by compiling the server-side code to one or a few DLL files on
the web server. This happens transparently in the background where the first time a page
is requested (i.e., the developer need not perform a separate compilation step for pages).
This provides the ease of development offered by scripting languages with the
performance benefits of a compiled binary.
The ASPX and other resource files are placed in a virtual host on an Internet
Information Services (or other compatible ASP.NET servers; see other implementations
below). The first time a client requests a page, the .NET framework parses and compiles
the files into a .NET assembly and sends the response; subsequent are served from the dll
files.
Developers can also choose to pre-compile their code before deployment,
eliminating the need for just-in-time compilation in a production environment.
ASP.NET compared to ASP Classic
ASP.NET attempts to simplify developers’ transition from windows application
development to web development by offering the ability to build pages composed of
controls similar to a Windows user interface. A web control, such as a button or a label,
functions in a very much the same way as its Windows counterpart: code can assign it
properties and respond to its events. Controls know how to render themselves: whereas
Windows controls draw themselves to the screen, web controls produce segments of
HTML and Javascript which form part of the resulting page sent to the end-user’s
browser.
ASP.NET encourages he programmer to develop applications using an event-
driven GUI paradigm (event-driven GUI model), rather than in conventional web-
scripting environments like ASP and PHP. The framework attempts to combine existing
6
technologies such as Javascript with internal components like “ViewState” to bring
persistent (inter-request) state to the inherently stateless web environment.
Other differences compared to ASP classic are:
Compiled code means applications run faster with more design-time errors
trapped at the development stage.
Significantly improved run-time error handling making use of exception handling
using try-catch blocks.
Similar metaphors to Windows applications such as controls and events, Which
make development of rich user interfaces, previously only found on the desktop,
possible.
An extensive set of controls and class libraries allows the rapid building of
applications, plus user –defined controls allow commonly used templates, such as
menus. Layout of these controls on a page is easier because most of it can be done
visually in most editors.
ASP.NET leverages the multi-language capabilities of the .NET CLR, allowing
web pages to be coded in VB.NET, C#, J#, etc. .
Ability to cache the whole page or just parts of it to improve performance.
Ability to use the code-behind development model to separate business logic from
presentation.
If an ASP.NET application leaks memory, the ASP.NET runtime unloads the
AppDomain hosting the erring application and reloads the application in a new
AppDomain.
Session state in ASP.NET can be saved in a SQL Server database or in a separate
process running on the same machine as the web server or on a different machine.
That way session values are not lost when the web server is reset or ASP.NET
worker process is recycled.
Previous versions of ASP.NET (1.0 and 1.1) were criticized for their lack of
standards compliance. The generated HTML and Javascript sent to the client
browser would not always validate against W3C/ECMA standards. In addition,
7
the framework’s browser detection feature sometimes incorrectly identified web
browsers other than Microsoft’s own Internet Explorer as “downlevel” and
returned HTML/Javascript to these clients that were crippled or broken. However,
in version 2.0, all controls generate valid HTML 4.0, XHTML 1.0 (the default) or
XHTML 1.1 output, depending on the site configuration. Detection of Standards-
compliant web browsers is more robust and support for cascading Style Sheets is
more extensive.
Criticisms of ASP.NET
ASP Classic and ASP.NET can be run side-by-side in the same web application.
This approach allows developers to migrate applications slowly instead of all at once. On
IIS 6.0 and lower, pages written using different versions of the ASP framework can’t
share Session State without the use of third-party libraries. This criticism does not apply
to ASP.NET and ASP applications running side by side on IIS 7, module may run in an
integrated pipeline that allows modules written in any language to be executed for any
request.
In some circumstances, unhandled exceptions can force the ASP.NET worker
processes to shut down. In this instance fresh worker process is loaded, the application is
loaded, the application is restarted and application and session state can be lost depending
on the configuration. Also, if the application relies on session state to store authentication
information and the application is configured to use in-process sessions, the user may be
logged out.
ASP.NET 2.0 produces markup that passes W3C validation, but it is debatable as
to whether this increases accessibility; one of the benefits of a semantic XHTML page +
CSS representation. Several controls, such as the login controls and the Wizard control,
use HTML tables for layout by default. However, some controls still rely on Javascript.
The CSS Control Adapters do help override output, even if it is to improve HTML, not
CSS.
8
Development tools
Several available software packages exist for ASP.NET applications:
Microsoft Expression Web Designer part of the forthcoming Microsoft
Expression Studio application suite.
Visual Studio.Net or Visual Studio 2005 or Visual Web Developer 2005 Express
Edition.
ASP.NET Web Matrix (ASP.NET 1.x only, was free, now no longer supported:
replaced by the free Visual Web Developer 2005 Express Edition).
Macromedia Dream Weaver MX, Macromedia Dream Weaver MX 2004, or
Macromedia Dream Weaver 8.
Macromedia Home Site 5.5.
Microsoft Share Point Designer 12.
Any text Editor such as Notepad, Notepad ++, Ultra Edit, Text Pad and others.
9
4.2 Microsoft SQL Server
Microsoft SQL Server 2000 is a relational database system that is scaleable from
small departmental networks to enterprise-wide networks. SQL server maintains the core
database files for use by custom database applications using development languages, such
as Visual Basic, Visual C++, .NET applications or by desktop applications, such as
Microsoft Word, Excel, and Access.
SQL server’s core database server runs on a Windows-based server, which is
typically connected to multiple client systems via an Ethernet local area network (LAN).
The client systems are typically PCs running SQL Server client software. SQL Server
supports the following client systems:
Windows NT/2000
Windows 9x
Remote Access Server (RAS)
Windows for Workgroups
Macintosh
DOS
OS/2
UNIX/ Linux
Thus SQL Server 2000 can be used as a powerful backend for .NET applications
and that is the perfect reason for selecting SQL Server 2000 as the backend for this
project.
10
SQL SERVER’s BASIC COMPONENTS
SQL Server has four basic server components. They are as follows
Open Data Services
MSSQL Server
SQL Server Agent
MSDTC
Open Data Services- component that provides an interface between the Server’s
Net-libraries and the SQL Server Engine (MSSQL Server).
MSSQL Server- This service manages all the files that comprise the SQL Server
database. It is also responsible for providing SQL statements and allocating system
resources.
SQL Server Agent- This service is responsible for scheduling SQL Server’s jobs
and alerts. In SQL Server terminology, a job is a predefined object consisting of one or
more steps, where each steps consists of a predefined data function like a Transact-SQL
statement or batch of statements, while an alert is an action taken in response to a specific
event. An alert can be set up to perform a variety of tasks, such as running jobs or
sending e-mail.
Microsoft Distributed Transaction Co-coordinator (MSDTC)- This is a transaction
manager responsible for coordinating database transactions across multiple servers.
MSDTC can be invoked either by the SQL Server database engine or directly from a
Client application.
11
Benefits of SQL
SQL Server provides a wide range of benefits through SQL and some of the
benefits are listed below:
SQL provides statements that can be used to create base tables to hold your
application data.
SQL can also used to create views.
SQL provides statements to retrieve, insert, update and delete individual rows
within a table or a view.
SQL also lets us to manipulate sets of rows.
The ‘where’ clause can be included in insert, update, select, delete statements for
condition specifications which can be used to filter data.
Another significant capability that SQL offers is the capability to define very
complex views. Views don’t store data, but they provide an alternative way to
access data in more than one underlying base tables. Thus one can use views to
simplify data access and to limit the data that specific user access.
For Windows and web application, SQL provides important database capabilities
not available with conventional file systems and HLL file I/O operations. Because
SQL can also be used with many other relational databases, include Oracle and
IBM’s DB2 family.
12
5. MODULE DESCRIPTION
This project “Online Examination” consist of four modules. The modules are as
follows:
Signin
Signup
Evaluation
Form load module
Signin
The signin module prompts the user to enter his user name and password, which
are already provided to him when e signup with the project for the first time. When he
clicks the Login button after entering the Username and Password, a new database
connection is made to the SQL Server database which refers the table that checks whether
the following username exist. If that username persist in table then it checks for password
field with that row. If the password matches with the password given in the table then it
allow user to login, else display Password mismatch error. If it doesn’t find the username
then it display user name doesn’t exist error.
This page allows the user to navigate to the Entry page when he clicked on the
Home button. The session is used to keep the user active till he logout of the project. The
VB script for the Signin module is as follows:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Button1.Click
Label3.Text = ""
If ((TextBox1.Text = "") Or (TextBox2.Text = "")) Then
GoTo bb
13
End If
Dim con As New SqlConnection("database=(local);initial
catalog=suresh;integrated security=true")
con.Open()
Dim cmd As New SqlCommand("select * from userlist", con)
Dim dr As SqlDataReader = cmd.ExecuteReader()
While (dr.Read())
If (TextBox1.Text = dr.Item(0)) Then
If (TextBox2.Text = dr.Item(1)) Then
Session("username") = TextBox1.Text
Response.Redirect("userscreen.aspx")
GoTo aa
Else
Label3.Text = "Incorrect Password"
End If
End If
End While
Label3.Text = "Incorrect user name"
bb:
Label3.Text = "Name/Password must not be empty"
aa:
End Sub
Signup
The Signup page is for the first time user of this project. It prompts them to enter
User name which must be unique, password, and Email id for the security purposes.
While the page gets loaded it displays the number of existing user on this web site. The
username, Password and gets stored in the database. The Signup module codes are as
follows:
14
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Button1.Click
If ((TextBox1.Text = "") And (TextBox2.Text = "")) Then
Label4.Visible = True
GoTo end1
End If
Dim i As Integer
i = 0
Dim con As New SqlConnection("database=(local);initial
catalog=suresh;integrated security=true")
con.Open()
Dim cmd As New SqlCommand("select * from userlist", con)
Dim dr As SqlDataReader = cmd.ExecuteReader()
Label6.Text = ""
While (dr.Read())
If (TextBox1.Text = dr.Item(0)) Then
Label6.Text = "User name already Exist"
GoTo terminate
Else
i = i + 1
End If
End While
con.Close()
con.Open()
If (i <> 0) Then
Dim cmd1 As New SqlCommand("insert into userlist
(nam,pass,emailid,test,highmark,lowmark,averg) values('" & TextBox1.Text & "','" &
TextBox2.Text & "','" & TextBox4.Text & "','0','0','0','0')", con)
cmd1.ExecuteNonQuery()
End If
15
TextBox1.Text = ""
TextBox4.Text = ""
Session("username") = TextBox1.Text
Response.Redirect("userscreen.aspx")
end1:
terminate:
End Sub
Evalution
This module is called on when the user clicks Next, Stop and End button in the
questionary page. Here a session called ‘mark’ is created and assigned as zero. This
provides the user to buttons two navigate, Next and Stop. Next is for advancing to the
next set of questions and Stop is for stop the test at the current point. Stop button leds the
user to the Result page, when it is clicked.
Both the above mentioned buttons namely, Next, Stop and End evaluates the
user’s answer to the raised questions and update the session mark when any one of them
is clicked. The session ‘mark’ last upto the end of the test. The code for evaluatio of the
questions are as follows:
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Button2.Click
Try
If (RadioButtonList1.SelectedItem.Text = HiddenField1.Value) Then
Session("mark") = Session("mark") + 1
Else
Session("mark") = Session("mark") - 1
End If
If (RadioButtonList2.SelectedItem.Text = HiddenField2.Value) Then
Session("mark") = Session("mark") + 1
16
Else
Session("mark") = Session("mark") - 1
End If
If (RadioButtonList3.SelectedItem.Text = HiddenField3.Value) Then
Session("mark") = Session("mark") + 1
Else
Session("mark") = Session("mark") - 1
End If
If (RadioButtonList4.SelectedItem.Text = HiddenField4.Value) Then
Session("mark") = Session("mark") + 1
Else
Session("mark") = Session("mark") - 1
End If
If (RadioButtonList5.SelectedItem.Text = HiddenField5.Value) Then
Session("mark") = Session("mark") + 1
Else
Session("mark") = Session("mark") - 1
End If
Response.Redirect("Test3.aspx")
Catch
label1.text = "Please answer All Questions"
End Try
End Sub
Form Load
This Module retrives user records such as User’s average score, Max Score,
Minimum score and number of test attended by the user. This loads immediately when
the user had signed in. The above mentioned details are retrived from database using
“form-load” event. From here one can start a new test, get back to Home page and also
17
Signout from the website. Thus the project is an dynamic one. The Code for Form load
module are as follows:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Label10.Text = Session("username")
Label2.Text = Session("mark")
End Sub
Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LinkButton1.Click
Response.Redirect("entry.aspx")
End Sub
18
6. SAMPLE SCREEN
Entry page
19
Signin
20
Signup
21
5
Test
22
Result
23
23
7. CONCLUSION
This Project,”Online Examination” is best and efficient method to develop the IQ
skill of any person who has clear idea of how to use this website. This can be suitable for
any person those who wants to involve in mind dazzling question game to improve
knowledge. In future, implementing more dynamical question format and interactive
manner of user and website administrator with user own question post to website can
extend this project.
24
8. BIBILIOGRAPHY
1) Rudraksh Batra, Charul Shukla and Anil Kumar Barnwal, ASP.NET 2.0 BLACK
BOOK, Dream Tech Press, First edition.
2) Jeremy Shapiro, SQL SERVER 2000: THE COMPLETE REFERENCE, BPB
Publicaton, Second edition.
3) Marco Bellinaso, ASP.NET 2.0 WEBSITE PROGRAMMING: PROBLEM –
DESIGN – SOLUTION, Tata Mcgraw Hills, First edition.
WEBSITES:
www.sitepoint.com/article/asp-net-getting-started/
www.asp.net/LEARN/videos/
www.aspnet101.com
25