Asp.
net Notes
Chapter One
1. ASP.NET: is a web development platform, which provides a programming model.
•ASP.NET: is a framework for developing dynamic web applications
2. Benefits of Asp.net
• Easier OOP language
• Quick drag and drop
• Code separation
• High security
3. Asp.net Vs Asp*
• Asp.net: Full features OOP
• Asp*: Limited OOP support
4. Web page Vs Web App
• Web page: Its Informational, its Content
• Web App: Its Interactive, its interaction with user 5. Why Asp.net
ASP. Net is a:
• high-speed.
• low-cost.
• easy to learn.
6. Asp.net Architecture and its Components
1. Language – A variety of languages exists for .NET framework.
Page. 1
a. They are VB.net and C#.
b. These can be used to develop web applications.
2. Library – The .NET Framework includes a set of standard class libraries.
a. The most common library used for web applications in .NET is the Web library.
b. The web library has all the necessary components used to develop.
c. Net web-based applications.
3. Common Language Runtime – The Common Language Infrastructure or CLI is a platform.
a. .Net programs are executed on this platform.
b. The CLR is used for performing key activities.
c. Activities include Exception handling and Garbage collection.
7. .Net frame work
NET Framework: is a software development platform developed by Microsoft for building and
running Windows applications.
8. Asp life Cycle
• Application Start: First is start the Application
• Object creation: Creation HTTP Context
• HTTP Application: Creation Webserver
• Dispose: release unmanaged resource
• Application End: unloaded from memory
9. Page life Cycle
• Page request: first time check, existing,
• Page start: creating request, response
• Page initialisation: Controls initializing
• Page load: give controls default value
• Validation: looking value is false/ true
• Post back even handling: is when a button is clicked the call is make and that call is called
post back even handling
• Unload: proses will delete.
10. Characteristics of Asp.net
• Code Behind Mode --- This is the concept of separation of design and code.
• State Management --- ASP. Net has the facility to control state management.
• Caching --- significantly improve the performance of an application.
Page. 2
11. Components and their Description
(1) Common Language Runtime or
CLR • Common Language Runtime It
performs
• memory management.
• exception handling.
• Debugging.
• security checking.
• thread execution.
• code execution.
• code safety.
• Verifications • compilation.
• The code that is directly managed by the CLR is called the managed code. When the
managed code is compiled, the compiler converts the source code.
• into a CPU independent intermediate language (IL) code.
• A Just-In-Time (JIT) compiler compiles the IL code into native code, which is CPU
specific.
(2) .Net Framework Class Library •
.Net Framework Class Library It contains
• a huge library of reusable types.
• Classes.
• Interfaces.
• structures.
• enumerated values, which are collectively called types.
(3) Common Language Specification
• Common Language Specification It contains
• the specifications for the .Net supported language
• and implementation of language integration.
(4) Common Type System •
Common Type System It
provides
• guidelines for declaring.
• Using and managing types at runtime.
• and cross-language communication.
Page. 3
(5) Windows Forms
• Windows forms contain the graphical representation of any window displayed in the
application.
(6) ASP.NET and ASP.NET AJAX
• ASP.NET is the web development model and AJAX is an extension of ASP.NET for developing
and implementing AJAX functionality. ASP.NET AJAX contains the components that allow the
developer to update data on a website without a complete reload of the page.
.Net Types
.NET Can be divided into Two
• .NET Framework
• .NET Core
.NET Framework: is the original implementation of .NET. It supports
• running websites.
• Services.
• desktop apps.
• more on Windows.
.NET Core: is a cross-platform implementation for running
• Websites.
• Services.
• and console apps: on Windows, Linux, and macOS.
.NET is open source on GitHub.
.NET was previously called .NET Core.
CHAPTER TWO
What is events ?
an action or occurrence such as a mouse click, a key press, mouse movements, or any
systemgenerated notification
• For example, interrupts are system-generated events. When events occur, the application
should be able to respond to it and manage it.
Events in ASP.NET raised at the client machine, and handled at the server machine. For example,
a user clicks a button displayed in the browser. A Click event is raised.
The most important application events are:
• Application End
Page. 4
• Session Start
• Session End
• Application Start
Common page and control events are:
• Data Binding
• Disposed
• Error
• I nit
• Load
• Pretender
• Unload
Event Handling Using Controls
All ASP.NET controls are implemented as classes, and they have events which are fired when a
user performs a certain action on them. ASP.NET Page Life Cycle Events
the page life cycle, the page raises some events, which could be coded. An event handler is
basically a function
Following are the page life cycle events:
Pre I nit
I nit
Incomplete
LoadViewState
LoadPostData
Preload
Load
Load Complete
ASP.NET client side coding has two aspects
1. Client side scripts : It runs on the browser and in turn speeds up the
execution of page
2. Client side source code : ASP.NET pages generate this What is ASP.NET
Directives ?
ASP.NET directives are instructions to specify optional settings
what is The Application directive?
Page. 5
The Application directive defines application-specific attributes
what is The Page Directive?
The Page directive defines the attributes specific to the page file for the page parser and
the compiler.
Chapter Three
Controls: - Are small building blocks of the graphical user interface, which include text
boxes, buttons, check boxes, list boxes, labels, and numerous other tools.
Data source controls - These controls provides data binding to different data sources.
Data view controls - These are various lists and tables, which can bind to data from
data sources for displaying.
Personalization controls - These are used for personalization of a page according to
the user preferences, based on user information.
Login and security controls - These controls provide user authentication.
Master pages - These controls provide consistent layout and interface throughout the
application.
Navigation controls - These controls help in navigation. For example, menus, tree
view etc.
Rich controls - These controls implement special features. For example, AdRotator,
File Upload, and Calendar control.
Types of Controls?
Label: - This control is used to display textual information on the web forms.
Textbox: - This is an input control which is used to take user input.
Button: - is used to perform events. It is also used to submit client request to the server.
Hyperlink: - It is a control that is used to create a hyperlink. It responds to a click event.
Radio Button: - It is an input control which is used to takes input from the user. It allows
user to select a choice from the group of choices.
Calendar: - It is used to display selectable date in a calendar.
Check Box: - It is used to get multiple inputs from the user.
Link Button: - It is a server web control that acts as a hyperlink.
Dropdown List: - is a web server control which is used to create an HTML Select
component.
Master Pages?
Are used when user needs a consistent look and behavior over all web pages in an
application.
Advantages of the master?
They allows user design the rendering of the controls in the placeholder
Page. 6
It is centralized with common functionality of all pages to makes updates in one place.
Chapter four
Validation controls?
These are used to validate user input and they work by running client-side script.
There are six validation controls :-
RequiredFieldValidator: - It is used to make sure that the user enters some information in a field.
CompareValidator: - it can be used to make sure that the user enters identical data in two input fields.
RangeValidator: - You set the lower and upper bounds of the range as properties of a
RangeValidator Control.
RegularExpressionValidator: - Control confirms that the entry matches a pattern defined
by regular expression.
ValidationSummary: - is used to summarize the error messages from all validators on a web
page in a single location.
Chapter Five
State Management: - is very important feature in ASP.NET.
State management can be classified into two types.
Client side state management: - Client side state management can be handled by
Hidden Fields:- is used to store small amount of data on the client
Advantage
All browsers support hidden field.
No server resources are required.
Disadvantage
They can be tampered creating a security hole.
Page performance decreases if you store large data, as the data are stored in
pages itself.
View State:- View state is used to store user’s data, which is provided by Asp.net client side state
management mechanism.
Advantages of View State
Easy to Implement.
No server resources are required
Enhanced security features
Disadvantages of View State
Security Risk
Performance
Page. 7
Device limitation
It can store values for the same page only
Cookies
Control state
Query String:- is a collection of character input to a computer or a browser.
Advantage
Easy to use.
No extra effort is needed to code.
No server resources are required
All browser supports Query String
Disadvantage
There is a limit to URL length of 255 characters.
Query String data is directly visible to user thus leading to security problems
Server side state Management?
The session is the important features of asp.net
Session state is used to store value for the particular period of time.
Side state management can be handled by
Application state:- is used to store data on server & shared for all the users and it can be
accessible anywhere in the application.
The application state is used same as session, but the difference is, the session state is
specific for a single user.
Session state
Chapter Six
ADO.NET:- is an object model used to establish connection between application and data
source.
Data source can be database and XML
It consist of classes that can be used to connect, retrieve and manipulate data
Main component used for accessing and manipulating data are Data provider and Dataset
Page. 8
Namespaces used in ADO. Net
System.Data:- It contains the common classes for connecting, fetching data from database.
Classes are like as Data Table, Data View etc.
System.Data.SqlClient:- It contains classes for connecting, fetching data from Sql Server
database. Classes are like as SqlDataAdapter, SqlDataReader etc.
System.Data.OracleClient:- It contains classes for connecting, fetching data from Oracle
Database. Classes are like as OracleDataAdapter, OracleDataReader etc.
System.Data.OleDb:- It contains classes for connecting, (pitching data from id database (like
MS access, db2, oracle, MySQL).Classes are like as OleDbDataAdapter, leDbDataReader etc.
Component of ADO.NET architecture
The two key components of ADO.NET are
Dataset?
Which is disconnected from the data source and doesn’t need to know where the data
it holds came from.
Page. 9
The .NET data Providers allow us to connect to the data source, and to execute SQL
commands against it.
Data Providers:- is a set of ADO.Net classes that allow us to access a database.
Basically, it is a bridge between our application (We can say front-end) and data source.
There
Are following Data Provider:
Command Object
The Command:-The Command object which is used to execute a command.
ExecuteNonQuery: Executes commands that have no return values such as INSERT,
UPDATE or DELETE.
ExecuteScalar : Returns a single value from a database query.
ExecuteReader. Returns a result set by way of a DataReader object.
Page. 10
Data Adapter Object.
Data Adapter: - serve as a bridge between a Dataset and data source for retrieving and
saving data.
The DataAdapter provides this bridge by using Fill to load data from the data source
into the DataSet and Update to send changes made in the DataSet back to the data
source.
Data Reader Object
The DataReader:- object which provides a forward-only, read only, connected recordset
Limitations of the DataReader:- There is not possible to sort, filter, or manipulate the data
while using a DataReader, since it is read-only and forward-only.
Page. 11