Notes
Notes
Notes
NET
Contents of ASP.NET:
Requirement: A technology to contact the external resources and to provide the response
back to the client.
Solution: Serverside technology
Advantage: Performance will be very fast.
Drawbacks: Resources of webserver will be blocked.
Resources of webserver will not be utilized efficiently
Requirement: A technology to contact the external resources and to provide the response
to the clients without providing any burden to the clients and webserver.
Solution: Server pages technology
Drawbacks of ASP.3.0:
ASP = HTML (for user interface(these are browser dependent i.e. tags are different for different browses))
+
Java Script (for client side validations)
+
VB Script (for server side control)
+
ASP built in objects
+
COM (for interacting with external resources)
Architecture of ASP.NET:
where
IIS means Internet Information Services
aspnet_isapi.dll means ASP.NET Internet Server Application Programming Interface
wp means worker process
inet info.exe identifies aspx or asp
Requested page is processed is a 10 stage i.e. ASP.NET page life cycle
4
Whenever a client sends a request to the ASPX page to the webserver then “inetinfo.exe”
is a process which identifies the request type and incase if it identified the request is
called ASPX page then it sends a request for ASP.NET script engine (aspnet_isapi.dll).
Once a request is accepted by the script engine it will further send a request to the
ASP.NET runtime environment (“aspnet_wp.exe”) where the configuration files are
verified and the requested page is processed and the result will be provided as HTTP
response to the client.
Machine.config: It is a configuration file which provides the configuration details for all
the ASP.NET web applications registered within the server.
web.config: It is a configuration file which provides the configuration details for the
requested web application.
where configuration details specifies the language to be used for implementing ASP.NET
specification, state management information, connection strings to be used for interacting
with the database, tracing and debuggings, profiles management, used to provide the
security details such as authentication and authorization, globalization and localization
settings etc.
5
1) Side by side execution: ASP and ASP.NET pages can be executed simultaneously
and can exist within a single application.
2) Server side controls: ASP.NET technology has introduced rich powerful
webserver controls which are capable to identify the clients browser and can
render the HTML tags accordingly.
Note: Web server controls are state managed controls.
3) Performance: Architecture of ASP.NET is designed in order to increase the
performance of the application.
Note: ASP.NET application are 28 times faster than JSP application.
4) Session: It is used to maintain the state of the user i.e. the user information across
the webforms present within the application.
Enhancements:
Sessions in ASP.NET can be either a cookie based or it can be
cookieless.
Sessions in ASP.NET can be enabled or it can be disabled in any
webform present within the application as per the requirement.
Session information of ASP.NET can be maintained at the webserver
or at the state server or at sqlserver database.
Software requirements:
Operating System Service Pack (is software) .NET framework
SDK 2.0
Win NT 4.0 6 Yes
Win 2000 4 Yes
Win XP 2 Yes
Win 2003 1 Yes
Design tools:
Microsoft Visual Studio.Net 2005 professional [1.6 GB + Hard Disk]
Microsoft Visual Web Developer 2005 [800 MB]
(only ASP.NET application runs and free download from internet)
Macromedia Dream Weaver Mx [300 MB + Hard Disk]
7
Webserver Controls
Table: It is used to divide the webform into logic blocks such that the controls can be
grouped together and backgrounds can be set for individual blocks and also used
to design a webform to provide an effective look and feel.
STANDARD CONTROLS:
id: It is used to specify an unique identifier for the control placed on the webform.
Text: It is used to set or get the value from any webserver control.
Textbox Control: It is used to accept a single line, multi line or password characters as
the input.
Properties:
Textmode: Used to specify the mode to accept the input from the user.
(Default mode is single line).
Max Length: It is used to specify the maximum characters that can be accepted as the
input.
Read only: It is used to define a control as a non-editable control.
_______________________________________________
Properties:
Checked: Returns true if the radio button is selected else returns false.
GroupName: Specify a name to logically group all the related radio button controls.
_______________________________________________
Common properties for the list controls which supports single item selection:
RepeatDirection: Used to specify the direction in which the list item has to be displayed.
(Default direction is vertical).
Code part:
DropDownList Control: It is used to select a single item from a collection of list items.
Note: The properties used for RadioButtonList are applicable for DropDownList control
control.
_______________________________________________
Syntax:
ArrayList alObject = new ArrayList();
Note: Whenever an object has been assigned as a data source for any standard controls
then schema information will be binded but not the data.
Note: Whenever the data bind method is used within the page load event then the method
should be used carefully else the control will not maintain its state.
_______________________________________________
CheckBox Control: It is used for selecting a boolean value i.e. true or false.
Property:
Checked: Returns true if the check box is selected else returns false.
_______________________________________________
Common properties for the list control that supports multiple item selection:
Items.Count: Returns the number of list items present within the list control.
Items [index].Selected: Returns true if the specified list item is selected else returns false.
_______________________________________________
ListBox Control: It is used to select a single item or multiple items from a collection of
list items.
Property:
Selection Mode: It is used to specify the mode of selecting the values from the list
control.
(Default selection mode is single).
Note: If selection mode is single then the properties used for radio button list control can
be used and if selection mode is multiple then the properties used for check box list
control can be used.
Items.Add (string or list item): It is used to add a list item to the items collection of the
list control.
Note: If the string is passed as the argument value then the text and the value for the list
item will remain the same.
Inorder to provide different value for the text and values for list item, then list item
object should be passed as the argument value.
To do:
ListItem liobject = new ListItem();
Liobject.Text = value 1;
Liobject.Value = value 2;
listControl.Items.Add(liobject);
Items.Clear(): It is used to clear all the items present within the items collection of the list
control.
Property:
Advertisement File: Specify the name of the XML file which provided the details about
the advertisements to be placed on the webform.
Target: Specify the name of the frame in which the advertisement has to be opened.
(Default target is _top)
<Advertisements>
<Ad>
<ImageUrl>…</ImageUrl>
<NavigateUrl>…</NavigateUrl>
<AlternateText>…</AlternateText>
<Impressions>…</Impressions>
</Ad>
<Ad>
….
….
</Ad>
</Advertisements>
_______________________________________________
Property:
SelectedDate: Returns the date selected within the calendar control.
SelectedDates: Returns the list of dates selected within the calendar control.
Note: In order to select more than a single date then the selection mode property of the
calendar control should be set.
In order to customize the table cells present within the calendar control then DayRender
event should be used DayRender event will be executed for each and every Calendar day
present within the calendar control.
(TableCell)e.cell
Literal Control: It is used to add a string as a control to any other standard controls.
Syntax:
ControlName.Controls.Add(Control or object);
ControlName.Controls.Clear();
_______________________________________________
File upload Control: It is used to read a file present at the clients system and used to
upload the file to the webserver.
1) Create a folder for maintaining the uploaded files at the web server.
2) Set the permission for reading and writing the contents on the folder (Right click
properties, security, full control tick, OK).
_______________________________________________
Panel Control: It is a container control which is used to logically group the controls
together.
Note: Whenever any control has to be added dynamically at the runtime to the webform
or if a group of controls has to be set with common property such as visible property then
panel control should be used.
_______________________________________________
Wizard Control: It is used to design a web application or a web form using various steps
where every single step can maintain a collection of controls.
13
VALIDATION CONTROLS:
These controls are used to validate the user input.
Required Field Validator: It is used to verify whether the user has provided a value for
a control or not.
Note: A single validation control can be used to validate a single webserver control.
A single webserver control can be binded with any number of validation controls.
Note: Whenever validation controls are used then the validations are performed at client
system only.
_______________________________________________
Compare Validator: It is used to validate the input of one control by comparing the
value present at other control.
Properties:
ControlToCompare: Specify the name of the control which acts like a source.
Type: Specify the data type to be used for comparing the values.
(Default type is string).
Note: Other than Required Field Validator all the remaining validation controls will not
validate the control if the value of the control is empty.
_______________________________________________
Range Validator Control: It is used to validate the user input whether the given value is
existing within the specific property.
Property:
Minimum Value: Specify the lower range.
Maximum Value: Specify the upper range.
Type: Specify the data type to be used for validating the user input.
14
_______________________________________________
Custom Validator: It is used to validate the user input based on the user defined
functionality.
Note: It is the only validation control which can validate the user input at client side and
also at the server side.
Property:
Client Validation Function: Specify the client side java script function name which is
used to validate the user input at the client system.
Events:
Server Validate: The code written within this event will be executed implicitly to validate
the user input at the server side.
_______________________________________________
Property:
ValidationExpression: Specify the expression to e used for validating the user input.
Occurrences: It is used to specify the occurrence of the character within the expression.
{number}: Accepts the input if the length of the expression is equal to the specified
number. Ex. \d{6}
{minNumber, }: Accepts the input if the length of the expression is greater than or equal
to the specified minimum number.
{minNumber, maxNumber}: Accepts the input if the length of the expression is between
a specific range.
15
Mode: It is used to specify the occurrence of the characters specified within the
expression.
Note: Error messages of other validation controls will be considered as a input for the
validation summary control.
Note: Whenever validation summary control is used within the form then it is mandatory
that for other validation controls text property has to be set.
Note: Validation summary is the only control which is capable to project a message box.
_______________________________________________
16
ADO.NET
(Active X Data Objects for .Net)
1) Disconnected Model: If used to interact with the database then the connectivity
between the application and the database is not required while performing
navigations or manipulations on the data.
2) Connection Oriented Model: If used for interacting with the database then the
connectivity between the application and the database has to be maintained till the
application interacts with the database.
Connection: It is used to establish physical relationship between the application and the
database.
Update (DataSetName, Data Table): It is used to read the data from the data members of
the dataset and used to update the database with that data.
Dataset: It is an in-memory representation of the data at the client system in the format of
XML.
Note:
1) Dataset can maintain the information about any number of tables irrespective of
their native database.
2) Dataset supports establishing relationship between the data members of the
dataset.
3) Dataset will not be aware of the information about the data tables from which
database they belong to.
4) Any manipulations performed o the dataset will not be reflected on the database.
17
1) Typed Dataset: Whenever a dataset is defined using the XML schema definition
then it is said to be typed dataset.
Note: The data members of the typed dataset will be binded to the dataset at the
design time itself.
Note: Dataview should be used if the data has to be sorted or if the data has to be
filtered or if the data has to be projected in pagewise.
DataReader: It is a read only and forward only recordset which maintains the data
retrieved by the command object using connection oriented object method.
SqlServerDB:
(System.Data.Sqlclient) is Namespace
SqlConnection
SqlCommand
SqlDataReader
SqlDataAdapter are classes.
OracleDataAdapter
ODBC Drivers: (Open Database Connectivity)[DSN (Data Source Name) Based Model]
(System.Data.Odbc)
OdbcConnection
OdbcCommand
OdbcDataReader
OdbcDataAdapter
Syntax:
Connection:
In VB.Net: modifier objectName as new xxxConnection(connectionString)
Where xxx in above syntax can be either Sql, Oracle, Oledb or ODBC.
DataAdapter:
Note: Whenever a DataAdapter is defined using the above syntax then select command of
data adapter will be generated (other commands will not be generated).
19
DataSet:
Note: Whenever a dataset is defined using the above syntax then it is said to be untyped
dataset.
DataView:
Command:
In VB.Net: modifier objectName as new xxxCommand([Sql Statement, ConnectionObject or ConnectionString])
In C#: xxxCommand objectName = new xxxCommand ([Sql statement, ConnectionObject or ConnectionString]);
DataReader:
In VB.Net: modifier objectName as xxxDataReader
In C#: xxxDataReader objectName;
ADO.Net 2.0
ObjectDataSource
SqlDataSource
XMLDataSource
AccessDataSource
ObjectDataSource: Whenever a data access layer has to be used as a data source for the
application then object data source should be used.
Step 2: Assign the data row of the data member of the data set to the data row variable
Syntax: rowVariable = DataSetName. DataTable.NewRow ();
Step 3: Assign the values to the data columns of the data row variable
Syntax: rowVariable[columnIndex or columnName] = value;
Step 4: Add the data row variable to the data rows collection of the data member of the
data set
Syntax: Datasetname. Datatable. Rows. Add (rowVariable);
Step 5: Update the data adapter with the data present at the datamember of the dataset
Syntax: DataAdapterName. Update(DatasetName, DataTable);
Step 2: Update the dataadapter with the data present at the datamembers of dataset
Example:
}
22
Inserting:
DataRow row;
row = ds.Tables[0].NewRow();
row[0]=usr;
row[1]=pwd;
ds.Tables[0].Rows.Add(row);
da.Update(ds.Tables[0]);
return true;
}
catch(Exception ex)
{
return false:
}
}
DataRow row;
row=ds.Tables[0].Rows.Find(usr);
row.BeginEdit();
row["pwd"]=npwd;
23
row.EndEdit();
da.Update(ds.Tables[0]);
return true;
}
ds.Tables[0].Rows.Find(usr).Delete();
da.Update(ds.Tables[0]);
return true;
}
Customize GridViewControl
Customizing GridViewControl to project scroll bar
Customizing GridViewControl to add controls dynamically at the runtime and to read the
value from the gridview:
The collection of all the row present within the gridviewcontrol is called as rows
collection.
Whenever the user selects any specific row within the gridviewcontrol then it is said to be
selected row.
Inorder to refer to selectedrow from any events other than the gridview events then
GridViewName. SelectedRow should be used.
The above syntax should be used if gridview selectedindex changed event is used.
Inorder to refer a selected row from the grid view events then: e.Row should be used
where ‘e’ is an gridview row event args variable.
(TableCell)GridViewName.SelectedRow.Cells[cellIndex]
Ex:
TableCell ename;
For outside of gridviewcontrol:
ename= (TableCell) GridViewName.SelectedRow.Cells[1];
For within the gridviewcontrol:
ename= (TableCell) e.Row.Cells[1];
25
In order to read the value from the control present at the table cell of grid view control:
(ControlType) GridViewSelectedRow.Cells[cellIndex].Controls[controlIndex]
Ex:
CheckBox chkempno;
chkempno = (CheckBox)GridViewName.SelectedRow.Cells[0].Controls[0];
DropDownList ddljob;
Ddljob = (DropDownList)e.Row.Cells[2].Controls[0];
In order to add any controls dynamically at the runtime then row created event should be
used.
If the controls are added without the code (i.e. without programming) then index of
control will start with 1.
Customizing Grid control for adding the controls dynamically using the tools.
26
i) Application Level Globalization: If used then all the webforms present within the
application uses the same culture.
ii) Page Level Globalization: It is used to globalize any specific webform present within
the application.
Note:
CultureInfo: It is a class which acts like a repository for maintaining all the cultures
supported by the technology and also it is used to define a culture specific object.
CurrentCulture: It is a property which is used to set the current processing thread culture
to any specific CultureInfo object.
27
Localization: It is used to localize the form based on the information present within the
satellite resource assembly files.
Satellite assembly resource file: It is used for maintaining the resource information of the
.Net form.
Note: Satellite assembly resource file contents and the filename are case sensitive.
Note: If an application supports n cultures then n+1 satellite assembly resource files
should be created.
Note: The filename for satellite assembly resource for any specific culture should be in
following format:
For ex:
Main Resource File: myResource.resx
Resource File Telugu (India) : myResource . te-IN.resx
_______________________________________________
Style Sheets:
It is used to build the styles for the html contents present within the webform.
The extension for the cascading style sheet file should be ‘.css’.
Note: A single class can be used to provide styles for any number of webserver controls.
28
Skin file: It is used to provide the styles for the webserver controls.
The extension for a skin file should be ‘.skin’.
Theme:
The collection of style sheets and the skin files is called as a theme.
_______________________________________________
29
Security in ASP.NET:
i) Forms authentication: It is used to provide security for the intranet or internet based
application.
To do:
Set the configuration file to use Forms authentication.
In web.config:
<authentication mode = “Forms”/>
Authorization: It is used to allow or deny the users from accessing the webforms present
within the application.
Syntax:
<authorization>
<allow users = “user1, user2, … or * ”/>
30
Note: Within a single webapplication there can be any number of web.config files.
LOGIN CONTROLS:
LoginView: It is used to provide a different views based on the user login details.
Note: LoginView supports two types of templates:
1) Anonymous template
2) Logged in template
PasswordRecovery: This control accepts the user name and provides the security
question and if the question has been answered with the correct security answer then this
control will update the password of the user and mails the new password to the email id
provided at the user registration.
LoginStatus: It is used to provide the status of the user and also it is used to provide
functionality to login or to log off based on the user login status.
Note: If login.aspx is not present within the main application folder then this control will
raise an error at the runtime.
LoginName: Returns the name of the user logged within the application.
CreateUserWizard: It is a wizard control which is used to register a new user for the
ASP.NET web application.
ChangePassword: It is used to update the old password with a new password if the user
provides a valid user credentials.
ii) Windows Authentication: It is used to provide the security for the intranet based
applications based on the users registered within the network.
In web.config file:
<authentication mode = “windows”;
<authorization>
<allow users = “domain / username, … or *”/>
<deny users = “domain / username, … or *”/>
</authorization>
Whenever the user who sends the request is one among the users present within the
allow users list, then the requested page by the user will be provided as the response.
Trusting the user credentials and providing the response is said to be impersonation.
If the user who sends a request is logged one among the users present within the allow
users list, then the web server will project network login window as the response.
iii) Passport Authentication: It is used to maintain the same user credentials across the
multiple applications which are partners of Microsoft.
To set passport authentication:
Steps:
Install Microsoft passport SDK
Configure web.config file to use passport authentication
In web.config file:
Syntax:
<authentication mode = “passport”>
<passport redirecturl = “internal/url”/>
</authentication>
32
1) Session Level State Management: it is used to maintain the state of the user across
multiple webforms present within the web application.
To achieve session level state management, sessions and cookies are used.
Sessions: It is used to maintain the user information across the web forms present within
the application by maintaining the data at the server side.
To set:
session [session Variable] = value;
The value that can be assigned to a session variable can be either a string or an object.
If string is passed as a value then the session information will be maintained within the
contents collection and if any object is assigned as a value then the information will be
maintained within the state objects collection.
The default expiration time for the session information will be 20 mintues.
Whenever ‘enableSessionState’ attribute has been set to false then the session object
cannot be used within that web form and the resources required for maintaining the
sessions will not be allocated for that page.
If ‘enableSessionState’ is set to false and if the session object is used within the form
then the asp.net runtime environment will raise an error.
Browsers are having a capability to disable the cookies and if the browsers has been
diabled with the cookies then the web application which uses cookie based sessions will
not function properly.
Inorder to identify the session id of the client session.SessionID should be used.
Cookieless Sessions: If used for maintaining the session information then the session id
of the client will be appended for all the navigate url accessed within the web application.
Where navigateurl is the url to which the user sending a requesting.
To set:
In web.config file:
<sessionState mode = “InProc” cookieless=”true”/>
Whenever cookieless sessions are used then as the session id of the client will be
appended on all the urls the application will function properly irrespective to cookies are
enabled or disabled at the client system.
Cookieless sessions can be used if and if the web application does not use any
confidential data.
By default the session information is maintained within the webserver as a InProcess.
Whenever the session information is stored as a InProcess within the webserver. If the
webserver crashes then the total session information maintained within the webserver
will be lost and hence if the same application is existing within other webserver, the data
cannot be accessed.
Maintaining session information as a out process: (i.e. Sql server database, State server)
Faster Slow
1) In memory cookies: If used for maintaining the user information then the cookie
details will be stored within the memory allocated by the web browser.
2) Permanent cookies: If persistant cookies are used for maintaining the user information
then the cookie details will be maintained within the file at the client system.
2nd method:
HttpCookie cookieObject = new HttpCookie (“name”, “value”);
Response.Appendcookies(cookieObject);
2nd method:
cookieObject.Expires = DateTime;
If a cookie has been defined without an expiration time then it is said to be an in memory
cookie and if the cookie information has been defined with the expiration time then it is
said to be persistant cookies.
Cookies can store only string information and the information will always be maintained
at the client system only.
35
Web browsers are having a capability to disable the cookies and if the browser disables
the cookie then the web application which uses cookies will not function properly.
Sessions should be used whenever the data has to be maintained confidential and if any
objects has to be passed across multiple webform and the data will be accessed by less
users.
Cookies should be used if only string information has to be passed across multiple pages
and if the data is not confident and if more number of users access the web application.
Application level state management: Whenever the information of all the users accessing
the web application has to be maintained then application level state management should
be used.
Assume that we have a web server within webserver we have web application and within
application has ‘n’ number of webforms.
To set:
Application[“variable”] = value; where the value can be either string or an object
If string information has been assigned to the application variable then the information
will be maintained within the contents collection and if any objects are assigned to the
application variable then the information will be maintained within the static objects
collection.
Application variable will not have any expiration period but if the server has been
restarted then the contents present within the application variable will be lost.
The information maintained within the application object will be shared for all the users
accessing the web application.
Whenever an application has been locked then once a complete page has been processed
then the application collection will be unlocked implicitly.
Application.Unlock(): It is used to release the lock defined on the application using the
Application.Lock method.
36
If the session information is maintained within the SQL server database or the state server
and if the session of the user has been expired this event will not be raised.
3) Page level state management: It is used for maintaining the state of the controls after
submitting the data to the server.
By default for all the web server controls page level state management will be enabled.
Inorder to achieve page level state management, view state will be used.
Viewstate is a class which maintains the state of the control by maintaining the
information in a name value pair within the view state bag collection.
whenever view state has been enabled for the control then the ASP.Net runtime
environment will define a HTML hidden field with a name _ _ ViewState and the value
will be encrypted.
SmtpClient: It is a class which is used to specify the smtp server name and port number
to be used for sending the email and also it provides the method called sending the email.
Properties:
Host: It is used to specify the Smtpserver name or its IPaddress.
MailAddress: It is used to specify the sender and the recipient mail address.
Inorder to send mails the system should be installed with Internet Information Services
i.e. webserver and smtp virtual server software.
Indexserver: It is used to maintain the index of the files present within the local drivers
of the system and also maintains the index of the web documents present within the web
server.
2) Web catalog
1) System Catalog maintains the index of all the files present within the local drives of
the system.
2) Web Catalog maintains the index of all the web documents present within the web
server.
Select statement for retrieving the data from the index server:
select filename, vpath from scope() where freetext(contents, ‘searchText’)
Caching: It is used for maintaining the result or the output of the webform temporarily.
Advantage: If used in a efficient manner the performance of the application will be
improved from 12 to 15%
Caching should be used if and if the following two features are supported:
1) The contents of the webform should be static.
2) The number of requests for the webpages should be more.
1) Page output cache: It is used to maintain the total output of the webform as a cache
information.
To set:
<%@ outputcache duration= “seconds” varybyparam = “controlName or arrayVariable or none”%>
VaryByParam: If assigned with any control or array variable then for every unique value
assigned for the VaryByParam attribute at distinct cache page will be created at the server
and will be maintained by the web server.
Inorder to support substitution caching ASP.Net 2.0 has introduced substitution control.
Inorder to project the dynamic information the substitution controls, method name
property should be assigned with the method that returns the dynamic information.
39
The method which projects the dynamic information should be defined as a static method
and it is mandatory that the method should accept http context argument.
3) Data Cache: It is used for maintaining the memory variables or objects as the cache
information.
To set:
1st method:
Cache[“key”] = value;
If the cache has been set using the above syntax then it is said to be low level caching.
2nd method:
Cache.Insert(“key”,value);
If the cache has been set using the above syntax then it is said to be high level caching.
To get or read:
To read string information:
variable = Cache [“key”].ToString();
Cache dependency: It is used to kill the cache if the contents present at the file binded to
the cache dependency object is modified.
1) Application level tracing: If set then the trace information will be displayed for all
the webforms present within the web application.
To set: [In web.config] file
<trace enabled = “true” requestLimit = “10” pageOutput = “true”/>
2) Page level tracing: It is used to enable or disable the trace information for any web
form present with the web application.
40
To enable or disable:
<%@ page language = “C#” trace = “true or false”… %>
Master Pages: It is used to design a template for the ASP.Net web application such that
based on that template information any number of content pages can be designed.
The extension for the master page should be .master.
A single web application can have any number of master pages. Master pages can be
nested. Master pages can be used as templates and cannot be executed.
Sitemap file:
It is an XML document which is used to maintain the path of the web forms used within
the web application in a hierarchy.
</siteMapNode>
</sitemap>
Profiles:
It is used to maintain the user information along with the system details permanently at
the SQL server database present at the server. Also called personalization of web form.
To set:
Variable = Profiles . ProfileName;
In order to access the profile information it is mandatory to set the profiles at the web
configuration file.
Whenever the profile information has been set explicitly then the information will be
maintained within aspnet_Profile table present the ASPnetDB.MDF database.
i) Well formed XML: Whenever the XML document represents only the data then it is
said to be well formed XML document.
Rules for creating a well formed XML document:
The extension for the XML document should be .xml.
XML document is a case sensitive file and the document does not have any predefined
tags like HTML.
The user is free to use any tag as per the requirement where a tag can be considered as
a string enclosed between angular braces i.e. <tag>
It is mandatory that the tag which has been opened has to be closed.
If the tags are nested then it is mandatory that the tags has to closed using a proper
hierarchy.
<RootElement>
<ParentElement>
<childElement> … </childElement>
…
</ParentElement>
…
…
</RootElement>
It is mandatory that a XML document should be defined using only one root element.
The above XML document gives an illusion that the data belongs to some employees
but the fact is for the system the above file is just a normal 7 bit ASCII text file which is
supported by all the platforms and the devices.
XML document cannot project or present the data on its own. Always the XML
document will depend upon some application to present the data.
A HTML page to project the XML document’s data.
ii) Valid XML document: Whenever a XML document is used to represent the data along
with the definitions then it is said to be a valid XML document where the definitions for
the document can be provided using XML schema definition file.
WriteXmlSchema: It is used to write the XML schema definition for the data present at
the data members of the dataset.
43
ReadXml: It is used to read the data from the Xml document and used to write that
information within the dataset as a datamembers.
ReadXmlSchema: It is used to read the Xml schema definition from the XSD file.
i) DOM Parser: (Document Object Model Parser) It is used to read the entire XML
document and parses the data and the result will be maintained within the cache.
DOM is of two types: 1) Non Validating DOM parser
2) Validating Parser
1) Non Validating DOM parser: It is used to parse a well formed XML document.
If a non validating DOM parser is used to validate a valid XML document then the parser
will verify only the rules of the XML specifications and if the document violates the
definition file then the parser will ignore and projects the data. (Example: Browsers)
2) Validating Parser: It is used to parse a valid XML document and if the document
violates the definition file then the system will raise an exception.(Example: VS.Net)
ii) SAX Parser: (Simple API for XML parser): It is used to parse only the requested
information and the result will not be maintained at the cache.
SAX parser is also called as event based parser.
ASP.NET AJAX
HTML: It is used to designing a web page where the page will be parsed by the web
browser.
Drawbacks:
HTML is a browser dependent language.
HTML cannot interact with the external resources like database.
HTML cannot be used for performing validations.
Java script: It is a scripting language which is used to perform client side validations.
Drawbacks:
In order to use Java script to interact with external resources like Livewire Software
should be installed within the server.
Serverside Technology: (CGI, Serve lets, ASP, JSP, …) It is a technology to interact with
the external resources like flat files database or network and used to provide the result as
a response to the clients.
Drawback:
The code has to processed at the server side and result has to be provided as a response
and hence for every request a new page will be generated and will be provided as the
response and hence the performance will be very slow.
Applets: It is a set of java code which will be loaded on client machine and will be
processed at the browser.
Advantage: As the code will be processed at the client system performance will be very
fast.
Drawback: Applets cannot interact with the client system resources. Web browsers should
be installed with Java Virtual Machine in order to support applets.
If synchronous method is used for web application development then till the server
provides the response to the clients the user cannot interact with the webform.
To support:
Mozilla Firefox, Opera, Neo Planet, Netscape, …
Create an object for XmlHttpRequest
Ex: variable=new XmlHttpRequest();
To support:
Internet Explorer 5.5
Ex: variable=new ActiveXObject (“Msxml2.XMLHTTP”);
Internet Explorer 6.0 or above
Ex: variable=new ActiveXObject (“Microsoft.XMLHTTP”);
Properties of XmlHttpRequest:
Value Status
0 Server not at accepted the request
1 Server accepted the request
2 Server initialized the process
3 Server is processing the request
4 Server has completed its processing
responseText: It is a property which is used to collect the response from the server if any
string information is passed as the response.
responseXmlText: It is a property which is used to collect the response as a XML
information.
Methods of XmlHttpRequest:
function(): It is used to submit the request to the server.
open(“GET or POST”, URL, boolean): It is used to send a request to the specified url
using get or post method.
If true is passed as a boolean value then asynchronous request will be sent and
46
If false is passed as a boolean value then synchronous method will be used for sending
the request.
send(object): It is used to submit the request to the server.
AJAXControlToolkit
Download ASP.Net AjaxControlToolkit.
Extract the AjaxControlToolkit to the following path
C:\Pgm files\Microsoft Ajax Control Toolkit
Open in Internet Explorer this i.e. above path.
Then open new website, in that select Ajax Enabled Website. By (Ctrl+Alt+x), right click
on ToolBox, Click on Add tab, specify(type) Ajax Client Side Controls.
Drag and drop Ajax Control Toolkit.dll file present at the following directory
C:\Pgm files\Microsoft Ajax Control Toolkit\Sample Website\Bin and drop on the tab
created on the tool box.
Requirement: A technology such that the code present in one system should be accessed
from the applications present in other systems connected within the network.
Solution: Distributed Network
Requirement: A technology such that the code or the definitions should be accessed from
the applications developed using any language for any platform or any device.
Solution: Web services
47
Web services: It is a specification to achieve cross language, cross platform and cross
device integration.
Web service specification has been provided by W3C consortium and implemented by the
following organizations:
XML Web services: It is a specification to achieve cross language, cross platform and
cross device integration or it can be considered as a class definition where the definition
is maintained within the webserver as a service such that the definitions can be accessed
from any application developed using any language for any platform or any device.
Descriptions: It provides information about the members of the web service such as the
attributes, the properties and the methods present within the web service.
Wire Formats: There are the protocols which are used by the web service inorder to
communicate between the systems which uses web service descriptions.
The protocols which are supported by the web service are: HTTP, SOAP
HTTP: It is a standard web protocol which is used to send a request and receive the
response from the server.
HTTP supports two methods for submitting the data: HTTP-GET, HTTP-POST.
The expression is the data which will be submitted from the client system to the server.
48
If HTTP-GET method is used for submitting the data, the above string will be appended
as a search to the navigate url.
HTTP-GET HTTP-POST
Appends the data as a search. Passes the data as streams.
Only limited data can be transferred. No limitation for the data transfer.
Only character data can be transferred. Any type of data can be transferred.
If the webform uses HTTP-GET then the If HTTP-POST method is used for
performance will be very fast. transferring the data, performance will be
comparatively slow.
CacheDuration: If set then the result or output will be maintained for the specified period
of time as a cache.
EnableSession: If set to true then the result will be maintained at the session.
MessageName: It is used to provide an alias name for the web method.
49
Web parts
Whenever the contents present at the web form has to be moved or removed or has to be
modified or if any new information has to be added dynamically to the web form by the
client then web parts should be used.
WebPartManager: It is a class which is used to manage all the web parts present within
the web form.
Whenever web parts are used in the web form then it is mandatory that the
webpartmanager control should be placed as the first control on the web form.
WebPartZone: It is used to define a single web part within the web form.
In order to design ‘n’ number of web parts then ‘n’ number of webpartzones should be
created.
The contents present in one webpartzone can be moved to other webpartzone directly at
the runtime.
CatalogZone: It acts like a container for maintaining the catalogs to be added
dynamically at the runtime to the webpartzone.
DeclarativeCatalogZone: It is used to maintain the contents or the control to be added on
the webpartzone.
Any number of DecrativeCatalogZones may be places within the catalogzone.
EditorZone: It acts like a container for maintaining the information that can be used for
modifying the webpartzone contents.
ApperanceEditorZone: It is a collection of properties which is used to set the appearance
of the webpartzone.
LayoutEditorPart: It is a collection of properties which is used to modify the layout of the
webpartzone.
PropertyGridEditorPart: It is a collection of properties which is used to set or get the
values from the user defined controls.
Whenever the display mode is browsed then the user can view the webparts.
If the display mode is design then the user can move the contents present within one
webpartzone to the other zone and also contents can be deleted.
If the display mode is catalog then the user can add the contents present within the
DeclarativeCatalogZone to any webpartzone.
If the display mode is edit then the client can modify the appearance, layout, property
and the behavior of the webpartzone.