Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
V
ASP.NET with C#
Time : 2 ½ Hrs.] Prelim Question Paper Solution [Marks : 75
r
using System.Collections.Generic;
using System.Linq;
ka
using System.Text;
namespace palindrome
{
class program
{
an {
static void Main (String args [ ])
int n, r, d = 0, n1;
1;
Console.WriteLine("Enter
riteLine("Enter
"Enter the no :");
[1 mark]
n = Convert.ToInt32(Console.ReadLine(
vert.ToInt32(Console.ReadLine(
oInt32(Console.ReadL ));
))
n = n1;
1;
al
n1 ! = 0)
while (n1 0
{
r = n1%10
n1%10; [3 mark]
dy
d = d * 10 + r;
n1 = n1/10;
}
Console.WriteLine("Reverse of "+ n + "is" + d );
Console.WriteL
if (d = = n)
Console.WriteLine (n + "is palindrome");
Console.W [1 mark]
Vi
else
Console.WriteLine(n + is not palindrome);
Co
}
}
}
1
Vidyalankar : T.Y. B.Sc. (IT) – ASP.NET
ka
{
static void main (string [ ]args)
{
int a = {11, 12, 13, 14, 15};
int p; // unassigned variable. ble.
int max = FindMax (a, outt p);
Console.WriteLine ("The The largest
gest element = " + ma
max + "at position
= " + p);
}
static int findMax ax (int
nt [ ]a, out int p)
p
{
int m;
m = a[0];
p = 0;
for(int i = 0; i < a.length;
a.length i++)
{
if(m < a[i])
a[i]
{
m = a[i];
p = i;
}
}
return m;
}
}
}
2
Prelim Paper Solution
In C/C++
The runtime problem causes abnormal termination of program howeverr in
Java / C++.
r
java/C#.
ka
There is a mechanism to take corrective action. on. In case of exception.
exception
Exception handing is implemented using following
ng keywords.
i) try
It contains code that needs to be monitored occurrence of
onitored for occur
exception.
an It exception is generated in try block ck there is chance
cha of it being
handled. When exception is generated
ated outside the try block, it
i cannot be
handled and causes abnormal
mal program
ogram termination. [1 mark]
iv)) finally
ly
dy
Q.1(d)
1(d) Explain CLR.
CL [5]
Vi
3
Vidyalankar : T.Y. B.Sc. (IT) – ASP.NET
x Type safety ensure that object are always accessed in compatible way.
If value of 8 byte given to 4 byte then error will occur by CLR and error
will attempt to trap.
x CLR consist of common rules that must be followed by all language using
.net framework these set of rules are called as Common Language angua
Specification (CLS).
x The CLS enables an object or application to interact with the bjects ects o
or
application of other language.
x The classes that follows the rules specified by CLS are termed ermed as CLS
r
compliant classes.
ka
x One of the specification defined in CLS is Common mon Typed
ped System (CTS).
x CTS provides a type system that is common acrosscross all languages.
x CTS defines rules that ensure that the data object written in va various
languages are able to interact with each h other.
r.
x During execution CLR performs following
owing steps
teps :
an (a) Loading assemblies & identifiesfies name
me spaces [1 mark]
x assemblies are loaded d into memory after loadin assemblies the
loading assem
CLR will identifies namespace
pace for the code in assemblies.
assemb
x namespaces are e collections of classes (similar
(s package
p in java)
namespaces are used to organised the classes
c in hierarchy.
x The namespaces
spaces have
ve public access
access & this ccan not be change.
application.
appli
x WWhen you create an object the CLR allocates memory for the
object from managed heap.
4
Prelim Paper Solution
r
i) Page_Render j) Page_Unload
e_Unload
ka
Page_Init [1 mark]
mar
It contains initialization code for example the
e server
ver controls are initialized
initial
to their default values.
LoadViewState [1 mark]
m
anIt restores the pages view state information
formation
n from its last saved
s state.
stat
PageLoad [1 mark]
It restores the control
ntrol the
he values of
o the web
w page
pag i.e. the data will be
binded to the data
a controls.
rols.
al
Page-PreRender nder [1 mark]
It is calledd prior to the rendering
ndering of
o page event
ev here we can add code to make
changes
ess in the rendered output.
dy
Save
ave View w State [1 mark]
It is responsible for saving view state information of web page.
PageRender [½ mark]
content of web page in the webbrowser you can make changes
It render the con
to the rendere output here.
rendered outpu
Vi
Page Unloa
Unload [½ mark]
event in life cycle of ASP.NET page. It is called after the page
It is the last e
has been rendered
r and is responsible for releasing the resource and
discarding the web page from memory.
discardin
Q.2(b)) Explain
Ex CSS & its types. [5]
(A) CSS offers with set of options to change every aspects of web sites. [½ mark]
x CSS is understood by all the browsers and so it is used for visual
presentation of web pages.
5
Vidyalankar : T.Y. B.Sc. (IT) – ASP.NET
r
<html>
ka
<body>
<hl style = “backgroundcolor:block; fontstyle:
Italic>Hello</h1>
</body>
<html>
an Embedded CSS
Here the style rule for the elementt or the clam all id us spe
head element of the page.
Style rule specified will be applied
pplied to every html el
[1½ mark]
specified in the
}
</style>
le>
</head>
</html>
External
ternal CSS: Here external stylesheet CSS rule is created and only
contains style
st rules.
rules
Vi
The
Th style rules are applied on every apperance of the elements wherever
oppear
opp on the web page. [1½ mark]
To link ext
external CSS page on the web page
<html>
<head>
<hea
<such fref= “stylesheet.CSS” vel = “Stylesheet” type “text/CSS”/>
</head>
</html>
6
Prelim Paper Solution
r
x It is a mechanism where memory alloted to o objectt forwhich no
ka
reference exist is regained automatically.
x It is routine that runs periodically whenn the system is free or wh
when
an allocation does not have sufficient memory.
ry.
(string [ ] args)
static void main (st
{
MyDelegate md; // Reference of delegate
md = new
n MyDelegate (add); // function name variable.
MyD
int P = md(10,
md( 20); // function call
Console.WriteLine ("Sum" + P);
Console
Vi
MyDeletage md1;
MyD
md1
m = new MyDelegate (mul);
P = md1(20, 40);
Console.WriteLine ("multiplication " + p);
}
}
7
Vidyalankar : T.Y. B.Sc. (IT) – ASP.NET
Note : [2 mark]
x Delegate is a type that enables you to store references to the function.
x Delegates are much like function but with no function body.
x It is declared using delegate keyword.
x The delegate declaration specifies the return type and parameterr list.
x After defining a delegate you can define a variable of delegate ate type
pe &
can initialize the variable as reference to function.
x We can call the function using delegate variable by passing arguments
ents to it.
r
Q.3 Attempt the following (any TWO) [10]
ka
Q.3(a) Explain RadioButton and CheckBox control. [5]
(A) RadioButton [½
[½mark]
mar
mark]
x The RadioButton control is used to display
y a radio
io button.
x Radiobuttons are used to Select single option
n from multiple optio
options.
Property Description
iption
AutoPostBack A Boolean value ue that specifies
pecifies whether
whethe the
an form should uld bee posted immediately
immed
hecked property has chang
the Checked
aultt is false
Default
after
changed or not.
Runat Specifies th
Spec that the control is a server
control.
ntro M Must be set to “server”
Text The
e te
text next to the radio button
TextAlign On which side of the radio button the text
should appear (rightor left)
Vi
Checkbox contro
control [½ mark]
x The CheckBox
Check control is used to display a check box.
x Check box
b control is used to select multiple choices.
AutoPostBack
Auto Specifies whether the form should be posted
immediately after the Checked property has
changed or not.
Default is false
CausesValidation Specifies if a page is validated when a Button
8
Prelim Paper Solution
control is clicked
Checked Specifies whether the check box is checked or
not
InputAttributes Attribute names and values used for the Input [2mark]
element for the CheckBox control
LabelAttributes Attribute names and values used for the Labelel
element for the CheckBox control
Runat Specifies that the control is a server control..
r
Must be set to "server"
ka
Q.3(b) Explain Web.Config file. [5]
(A) WEB.CONFIG [2 mark]
ma
The web.config file is an XML based file le configuration
iguration that cocontains
ations root directory.
application wide settings. It is present in applications directory We can
ca
lication but we can
have more than web.config file for the application c have only
anmachine.config file.
General form
< Configuration >
< System.web >
< !_Specify compilation, CustomError_Authentication,
ilation, CustomError_Authenticat
tomError_Authe Authorization . />
< /System .web b>
al
< appsettings
gs >
< !_Specify
cify file
e path, connection string,
st Servername,
S CustomSettings />
</ appsettings
psettings >
< /Configuration
Configuration >
dy
We can
an use web .configuration
.configurat for following :
fo
i) Uses < pages > section
sectio to
t specify whether session or view state is
nabled or disabled.
enabled [1 mark]
Example
< Configuration
Configurat
Co >
Vi
ii) We can use < Custom Errors > to specify Application wide Error
information. [1 mark]
< Custom Errors mode = “On” >
9
Vidyalankar : T.Y. B.Sc. (IT) – ASP.NET
r
(A) Global.asax [1 mark]
ka
It is an optional file use to handle application and session
n level events. The
Global.ascx contains code to handle application events that gets trigger
triggered
during start or end of application.
For first type of event ent which occurs in every request are executed in
al
following modelel : [2 mark]
ation_ Begin
a) Application_ egin Request ( )
plication_AuthenticateRequest ( )
plication_AuthenticateRequ
b) Application_AuthenticateRequest
c) Application_AuthorizeRequest
plication_Authoriz ()
dy
d)) Application_ResolveRequestCache
Application_ResolveRequestCac
lication_ResolveRe ()
e) ApplicationAcquire_RequestState
ApplicationAcqui
pplicationAc re_Request
_Req ()
f) Application_PreRequest
Application_PreRequestH
Application_PreRequestHandlerExecute ( )
g) Application_PostRequestHanlderExecute
Application_PostRequ ()
h) Application_ReleaseRequestState
Application_
Application_Release ()
i) Application_Upd
pplica
Application_UpdateRequestCache ()
Vi
j) Applic
Application_E
Application_EndRequest ( )
10
Prelim Paper Solution
Q.3(d) Explain the text box web server control. List and explain any four [5]
text box attributes.
(A) The TextBox control is used to create a text box where the user can input
text. [1 mark]
Textbox attributes (properties) [4mark]
4 mar
Properties Description
TextMode The type of text box. SingleLine creates a standard ard text box,
MultiLine creates a textbox that accepts more e than one line of
r
text and Password causes the charaacters that are re entered to
be masked. The default is SingleLine.
ka
Text The text content of the text box.
MaxLength The maximum number of characters erss that can be entered into
i
the text box.
Wrap Determines whether or nott text wraps automatically when it
reaches the end of a multiline
tiline text
xt box. The default true.
defau is tru
an ReadOnly Determines whether the user er can change the text in the
textbox. The default
fault iss False which means me text can be
te
changed.
Columns The width of f the text box in charac
characters. The
Th actual width is
determined
ed based
ed on the font that’s
that’s used ffor the text entry.
Rows The height
eight of
f a multi-line text bo
box in lines.
lin The default value is
0 which
hich sets line.
ets the height to a single lin
al
Q.4 Attempt thehe following
wing (any TWO)
TW )
TWO [10]
Q.4(a) Explain MasterPage e and steps to create MasterPage. [5]
(A) Masterr Page [2 mark]
dy
page.
e
x Extension: ".Master"
x Content page Stores page-specific elements that are put into the
master.
mast
Extension: ".aspx"
Ex
x Master page code behind can change master page after it acquires
content.
Extension: ".aspx.cs"
11
Vidyalankar : T.Y. B.Sc. (IT) – ASP.NET
<%@MasterLanguage="C#"AutoEventWireup="true"CodeFile="MasterPage.mas
MasterPage.mas
e.mas
ter.cs"Inherits="MasterPage"%>
r
<html>
<head runat="server">
ka
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
ver">
er">
</asp:ContentPlaceHolder>
</head>
<body>
<formid="form1"runat="server"> [2 mark]
an <div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1"
Holder1" runat="server">
ntentPlaceHolder1" runat="serve
runat=
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
al
Any element added to the master page outside
outsid the contentplaceholder will
appear on every content
ntent page that uses the master page.
at use
(A) State
tate management [2 mark]
ASP.NET stateless http protocol so every request from client
NET is based on state
browsed to web server is an iindependent request is understood as.
State management it a tectechnique used to maintain the state information for
asp.net
p.net pages cro multiple requests.
cross mul
Asp.Net comes
c with built in support for state management both at client
Vi
Ses
Session state
sta
duration of communication between client and browses. Session into is
It is dur
stored per use per session.
store
Session into can be saved in session object at server side.
Se
To specify whether or not to use cookie to stare session info
In web.config [1 mark]
<sessionstate cookieless = “true/false”/>
12
Prelim Paper Solution
r
<pages enable.Sessionstate = “true/false”/>
ka
Q.4(c) Explain two navigation controls. [5]
(A) Two Navigations Control
Navigation controls provided by ASP.net. ASP.Net followin three
Net provides following thre
navigations control.
ani) Treeview ii) Menu iii) SiteMapPath
SiteMapP
i) Treeview [2½
[ marks]
It arranges the pages in hierarchical
chical mannew. The
Th pages are organized
to form a tree structure.
e.
Steps to use treeviewiew control
ontrol
Since tree view control cannot fetch infor
information directly from sitemap
file hence it needs SiteMapDataSour
SiteMapDataSource.
al
Drag and drop
rop SiteMapDataSource
MapDataSource frfrom
tool box ata. It automatically
x o Data. automatical fetches
fetc information from SiteMap
file.
Drag
rag
ag and drop treeview from
box o navigation
toolbox
dy
treeviewtask o In c
In treeviewt choose datasource select SiteMapData Source
Save it Run it.
ii) Menu [2½ marks]
pages in menoform or it creates menu of pages.
It arranges the pag
Step tto use Me
Menu Control
Vi
Since menu view control cannot fetch information directly from sitemap
file hence it needs SiteMapDataSource.
Drag and drop SiteMapDataSource form toolbox o Data. It
automatically
aut fetches information from SiteMap file.
Drag and drop Menu from
tool-box o navigation
In Menu task o In choose datasource Select SiteMapDataSource
Save it Run it.
13
Vidyalankar : T.Y. B.Sc. (IT) – ASP.NET
r
iv) Regular Expression Validator
ka
v) Required field validator
vi) Validation summary
14
Prelim Paper Solution
v) RequriedFieldValidator [1 mark
mark]
General form
r
< asp : RequiredFieldValidator ID = “RequiredFieldValidator”
idator”
runnat = “Server” ErrorMessage = “RequiredFieldValidator”>
alidator”>
ka
</asp : RequiredFieldValidator >
15
Vidyalankar : T.Y. B.Sc. (IT) – ASP.NET
r
The DataProvider classes includes :
ka
(a) Connection (b) Command
(c) Data reader (d) Data Adapter
dapte
a bridge between Db & DataSet & it populates the data with the data
from db.
The DataAdapter provides 2 methods :
Th
(i) Fill (ii) Update
Fill : The fill method will populate dataset with value from db.
Update : Update method is use to commit changes back to the db.
16
Prelim Paper Solution
Q.5(b) Write a program to retrieve data from Table in connected Mode. [5]
(A) Using System;
Using System.Data.SqlClient;
Using System.Data;
[1 Ma
Mark]
Class Program
{
PSVM(String[ ] args)
{
SqlConnection con = new SqlConnection();
r
[2 Mark]
SqlCommand cmd = new SqlCommand();
ka
)”;
con.ConnectionString = “DataSource = (local)”;
InitialCatalog : Student; UserID = sa;
try
an {
con.open();
cmd.CommandTextt = “insertert into student (n
(name, num
number of KT)
C’,’, 5)”;
values (‘ABC’, 5)”
cmd.Connection
tion = Con;
cmd.ExecuteNonQuery();
cuteNonQuery();
nQuery(); [2 Mark]
}
al
Exception
catch(Exception n e) { }
finally
lly {con.Close
.Close ( ); }
}
}
dy
(ii) Form
For mode
mod : The data is obtained using HTML form & the
Authentication rule is specified by user itself.
Authen
(iii) Passport
Pass Mode : Microsoft provides passport based authentication
when user sign up for the passport then the authentication it is
w
stored at Microsoft server.
(b) Authorization [2 mark]
(i) File Based : Here the access specification is provided in a file called
ACL (access control list) the privilege of user is identified by the
list.
17
Vidyalankar : T.Y. B.Sc. (IT) – ASP.NET
r
<configuration>
ka
<identity impersonate = false>
</configuration>
Here impersonate = false means impersonation
nation is not supported.
ntrols in ASP.NET.
Q.5(d) Explain the various Data Source controls [5]
(A) DATA SOURCE CONTROLS IN ASP.NET
anDataSource provide efficient, flexible
ASP.Net
The various DataSourceControls
Controls
rols are :
extensib storage for data in
ble & extensible
2) SQLDataSource
QLDataSource control
cont : [1 mark]
dy
3)) LinqDataSource
LinqDataSour Control
Con : [1 mark]
It is used
u connect to collections of object from the application.
to conn
Vi
4) EntityDataSource
EntityDataS contend : [1 mark]
used to connect to dataSource in EntityDataModel supported by
It is use
.Net framework.
f
5) X
XMLDataSource Control : [½ mark]
It is used to connect to XML.
18
Prelim Paper Solution
r
located within update panel will cause refresh of the update
pdate panel.
ka
ii) Triggers : The trigger collection containss PostBack Back Triggers and
AsyncPostBack Trigger.
PostBack Trigger is used when we want to force complete page
refresh.
AsyncPostBack Trigger is used when you want to upda update
update on up
an panel.
iii) Render Mode : The properly Block indicate
erly can be set to Inline or Bloc
whether this update panel renders itself as <div> element or span
<div> elem
element.
iv) Update Mode : Itt determine
termine whether the control
c is
i always refreshed
(set to always)) or underss certain conditi
condition (Trig
(Triggers).
al
B) ScriptManager
nager Control
ntrol [1 mark]
ScriptManager
Manager acts as a bridge between
betwe client page and server. It
makes
es source that
hat the require ASP.NET AJAX files are included and
required ASP
AJAX
JAX support is added. It must be included on every page where we
wish to add AJAX functionality.
fun
dy
<asp : UpdatePanel
UpdatePanel ID =”UpdatePanel”
I =”U
“server”>
runat = ““se
UpdatePanel>
</asp : UpdatePane
ScriptManager ID = “ScriptManager1”
<asp : ScriptMan
Scr
runat = “server”>
ru
Vi
</asp : ScriptManager>
</a Scr
C) UpdateProgress
UpdatePr Control [1 mark]
Even though there was visual problem in postback but it has one
advantage
adv that user can see something is happening however with update
panel user will have no idea that something is happening until it has
happened.
To tell user to wait for few seconds while their request is processed, we
can use update progress control.
19
Vidyalankar : T.Y. B.Sc. (IT) – ASP.NET
Properties
i) DisplayAfter : It determines the time in milliseconds that the
control has to wait before it displays its content.
D) TimerControl [1 ma
mark]
The timercontrol is use for executing server side code on repetitive
tive
basis.
e.g. we can use it to update the content of update panel
el after every
very 5
seconds
r
Q.6(b) Explain LINQ operators. [5]
ka
(A) Operators in LINQ are as follows
Type Operators
Aggregation Average
Count
an Max
MIN
SUM
Conversion Cast
To Array
rray
Too Dictionary
To Sequence
equence
al
Element Element
men At
first
last
ast
Equality Equal
Equals
Generation
ration
n Range
dy
Group
roup Group By
Joining Join
J
Ordering Order B By Ascending Order By Descending.
Portioning Skip
Tak
Ta
Vi
Quantifying All
Any
Restriction
Restri Where
Selection Select
Set
Set ConCat
Distinct
InterSect
Union
20
Prelim Paper Solution
r
like animation and makes it easy to use AJAX in over er application.
ation.
ka
x We can download the latest version of JQuery Query from site
http://jquery.com
x Beside down loading the library from jquery uery website, any new website
we
that is created using ASP.NET website e template
plate contains script folder
scripts folde
with necessary JQuery files.
anx JQuery increases the size of your our webpage
page and hence it is
i a deliberate
del
choice to include it on your page
age or not.
x JQuery helps the program to keep conside.
ep the code simple and cons
x JQuery library is design n to keep the thing simple and
a revrevisable.
x JQuery simplifies the he process
rocess of html DOM
f traversal of h DO tree.
x It has following features
eatures :
i) Supports thehe event
ent
ii) Supportt AJAX
al
iii) Better
er effects
ects and animations [2 mark]
iv) DOM
OM element
ent selection fun
function
v) Support for CSS
vi) DOM traversal and modification
an modificat
dy
Q.6(d)
d) Explain any
a five methods of o J
Jquery. [5]
(A)) JQUERY EFFECT METHOD [Any Ten Five Mark]
x These methods improves look and feel of website, at client side.
method impro
x These are easy
e to use and are
animate( ) : It performs the specified animation for the element.
1) ani
Vi
21
Vidyalankar : T.Y. B.Sc. (IT) – ASP.NET
r
element.
ka
Q.7 Attempt the following (any THREE) [
[10]
Q.7(a) What is method overloading? Explain with example.
e [5]
(A) Method overloading provides the programmer create
mmer with the capability to creat
multiple methods with the same name, e, but each working with
w different
diffe
anparameters. [2 mark]
Example: [3mark]
class abc
{
public void Disp(int
nt a)
sp(int
{
Console.WriteLine(a);
e.WriteLine(a);
}
al
public
lic void Disp(int a, int b)
{
Console.WriteLine("{0}{1}",
Console.WriteLin
Console.WriteLine("{0}{1} a,b);
}
}
dy
class
ss Program
ogram
{
staticvoid
taticvoid Main(string[]
Main(string args)
Main(s
{
abc a1 = ne
newabc();
a1.Disp
a1 ((10);
a1.Disp
a1.Dis (10,20);
}
Vi
Q.7(b)
b) Purpose
Pur of assembly in .Net Framework. [5]
(A)
A) The pur
purpose of assembly in .Net Framework: [2mark]
x Assemblies
A in .Net are a solution to the Dll hell problem as one can use
different versions of same assembly in different applications at the
same time
22
Prelim Paper Solution
r
be run simultaneously (called side-by-side execution).
).
x simplify uninstalling and replicating applications.
ka
Q.7(c) What are the uses of AutoPostBack and runat at properties? [5]
(A) x The AutoPostBack property is used to set or returnturn whether or not an
automatic post back occurs when the user
ser selects an item in a llist
control.
x If this property is set to TRUE the automatic post back is enabled,
an otherwise FALSE. Default is FALSE.
E.
x Syntax
<asp:SomeListControl AutoPostBack="TRUE|FALSE"
utoPostBack="TRUE|FA runat="server"/>
run
[2 mark]
Example: [3 mark]
The following example
xample sets the AutoPo
AutoPostBack p property to "True" for a
al
RadioButtonList
st control:
ol:
<script runat="server">
rver">
Sub Change(obj As Object, e As EventArgs)
E
Response.Write("You
onse.Write("You selected " & rb1.SelectedItem.Text)
dy
End Sub
</script>
pt>
<form
form runat=server>
<asp:RadioButtonList id="rb1" AutoPostBack="True"
<asp:RadioButtonL
runat="server"
at="server" OnSelectedIndexChanged="Change">
<asp:ListItem Text="Item 1" />
<asp:ListI
Vi
Runat
Runat:
Runat='Server' Indicates the accessibility of the control at Serverside.
Ru
If runat="server" is placed inside any of the control then that control cab
23
Vidyalankar : T.Y. B.Sc. (IT) – ASP.NET
Q.7(d) List the different places in the web application where ViewState ate [5]
field can be disabled?
(A) Viewstate can be disabled at the following places in the web application.
plication.
n.
1. Page 2. Control 3. Application 4. Machine
ne [2 mark]
ark]
r
Page
<% @Page.EnableViewState=”false”/>
ka
Control
<asp : TextBox id=”Name” runat=”server” EnableViewState=”false”/>
eViewState=”false”/>
ewState=”false”/>
For Application [[3
3 mark
mark]
< Page enableViewState = “false” /?
anFor Machine
<Page enableViewState=”false” enableViewStateMac=”false”
ableViewStateMac=”false”
ateMac=”false” />
x Windows
dows authenticati
authentication [1mark]
In
n this methodology ASP.NET
AS web pages will use local windows users and
groups
roups to authenticate and
a authorize resources.
x Forms
orms Authentication [1mark]
This is a coo
cookie based authentication where username and password are
stored on client machines as cookie files or they are sent through URL for
Vi
every
ry rrequest. Form-based authentication presents the user with an HTML-
based Web page that prompts the user for credentials.
x Passport authentication [1mark]
Passport authentication is based on the passport website provided by
the Microsoft .So when user logins with credentials it will be reached to
the passport website (i.e. hotmail, devhood, windows live etc) where
authentication will happen. If Authentication is successful it will return
token to your website.
24
Prelim Paper Solution
Q.7(f) What is the use of Document Ready Event and explain with [5]
example.
(A) Document.Ready(): [3mark]
x It is used to prevent any JQuery code from running before the
document is finished loading because there are few functions which can
hich c
fail if they run before the document is loaded.
x General form-
$(document).ready(function( )
{
r
} );
ka
Example : [2mark]
[2 mark]
mar
<html>
<head runat=”server”>
<script type=’text/JavaScript” src=”jquery.js”>
uery.js”>
”>
an $(document).ready(function()
{
$(“button”).click (function()
unction()
n()
{
$( “table”).hide();
table”).hide();
e”).hide();
});
});
</script>
al
</head>
<body runat=”server”>
at=”server”>
r”>
<table
e border=1>
border
<tr> <td> 1</td 2</td> <td> 3</td> <td> 4</td>
1</td> <td> 2</td
dy
</tr>
</t
</table>
<input type=”button” value=”Hide”/>
value=”
</body>
</html>
tml>
Vi
25