0% found this document useful (0 votes)
133 views49 pages

Unit 1

ASP.NET is a web framework developed by Microsoft for creating websites, web applications, and web services, first released in January 2002. It is part of the .NET Framework, which includes components like CLR, FCL, and various libraries for different functionalities, supporting multiple programming languages. ASP.NET offers three development styles: Web Forms, ASP.NET MVC, and ASP.NET Web Pages, each catering to different programming needs and preferences.

Uploaded by

sachinmandalbgmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
133 views49 pages

Unit 1

ASP.NET is a web framework developed by Microsoft for creating websites, web applications, and web services, first released in January 2002. It is part of the .NET Framework, which includes components like CLR, FCL, and various libraries for different functionalities, supporting multiple programming languages. ASP.NET offers three development styles: Web Forms, ASP.NET MVC, and ASP.NET Web Pages, each catering to different programming needs and preferences.

Uploaded by

sachinmandalbgmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

INTRODUCTION TO ASP.

NET

UNIT - 1
Q1. What is ASP.NET ?

• ASP.NET is a web framework designed and developed by Microsoft.

• It is used to develop websites, web applications and web services.

• It provides fantastic integration of HTML, CSS and JavaScript.

• It was first released in January 2002.

• It is built on the Common Language Runtime (CLR) and allows


programmers to write code using any supported .NET language.
Q2. What is .NET FRAMEWORK 2.0 ?
• ASP.NET is a part of Microsoft .NET Framework. The following image shows the component
stack.
• .NET is a framework to develop software applications. It is designed and
developed by Microsoft and the first beta version released in 2000.
• It is used to develop applications for web, Windows, phone. Moreover, it
provides a broad range of functionalities and support.
• This framework contains a large number of class libraries known as
Framework Class Library (FCL). The software programs written in .NET are
executed in the execution environment, which is called CLR (Common
Language Runtime). These are the core and essential parts of the .NET
framework.
• This framework provides various services like memory management,
networking, security, memory management, and type-safety.
• The .NET Framework supports more than 60 programming languages such
as C#, F#, VB.NET, J#, VC++, JScript.NET, APL, COBOL, Perl, Oberon, ML,
Pascal, Eiffel, Smalltalk, Python, Cobra, ADA, etc.
• Following is the .NET framework Stack that shows the modules and
components of the Framework.
• The .NET Framework is composed of four main components:
• Common Language Runtime (CLR)
• Framework Class Library (FCL),
• Core Languages (WinForms, ASP.NET, and ADO.NET), and
• Other Modules (WCF(Windows Communication Foundation), WPF, WF,
Card Space, LINQ, Entity Framework, Parallel LINQ, Task Parallel Library,
etc.)
CLR (Common Language Runtime)
• It is a program execution engine that loads and executes the program.
It converts the program into native code. It acts as an interface
between the framework and operating system. It does exception
handling, memory management, and garbage collection. Moreover, it
provides security, type-safety, interoperability, and portability. A list of
CLR components are given below:
CLR (Common Language Runtime)
• PURPOSE ROLE OF CLR :-
1) Class Loader
2) Code Manager
3) Garbage Collection
4) MSIL to native compilers
5) Debugger
6) Security and Exception Handling
7) Type checker, Thread Support
FCL (Framework Class Library)
• It is a standard library that is a collection of thousands of classes and
used to build an application. The BCL (Base Class Library) is the core
of the FCL and provides basic functionalities.
WinForms

• Windows Forms is a smart client technology for the .NET Framework,


a set of managed libraries that simplify common application tasks
such as reading and writing to the file system.
ASP.NET
• ASP.NET is a web framework designed and developed by Microsoft. It
is used to develop websites, web applications, and web services. It
provides a fantastic integration of HTML, CSS, and JavaScript. It was
first released in January 2002.
ADO.NET
• ADO.NET is a module of .NET Framework, which is used to establish a
connection between application and data sources. Data sources can
be such as SQL Server and XML. ADO .NET consists of classes that can
be used to connect, retrieve, insert, and delete data.
WPF (Windows Presentation Foundation)
• Windows Presentation Foundation (WPF) is a graphical subsystem by
Microsoft for rendering user interfaces in Windows-based
applications. WPF, previously known as "Avalon", was initially
released as part of .NET Framework 3.0 in 2006. WPF uses DirectX.
WF (Workflow Foundation)

• Windows Workflow Foundation (WF) is a Microsoft technology that


provides an API, an in-process workflow engine, and a rehostable
designer to implement long-running processes as workflows within
.NET applications.
LINQ (Language Integrated Query)
• It is a query language, introduced in .NET 3.5 framework. It is used to
make the query for data sources with C# or Visual Basics
programming languages.
Entity Framework
• It is an ORM(Object Relational Mapping) based open source
framework which is used to work with a database using .NET objects.
It eliminates a lot of developers effort to handle the database. It is
Microsoft's recommended technology to deal with the database.

• Note :- when you are dealing with large size of DB, it is very usefull.
Parallel LINQ
• Parallel LINQ or PLINQ is a parallel implementation of LINQ to objects.
It combines the simplicity and readability of LINQ and provides the
power of parallel programming.

• It can improve and provide fast speed to execute the LINQ query by
using all available computer capabilities.
• Apart from the above features and libraries, .NET includes other APIs
and Model to improve and enhance the .NET framework.
ASP.NET provides three development styles
for creating web applications:
• Web Forms

• ASP.NET MVC

• ASP.NET Web Pages


1) Web Forms :-

It is an event driven development framework.

It is used to develop application with powerful data access.

It provides server side controls and events to create web application. It


is part of the ASP.NET framework.
2) ASP.NET MVC :-
It gives us a MVC (Model View Controller), patterns-based way to build
dynamic websites.
It enables a clean separation of concerns and that gives you full control over
markup for enjoyable, agile development.
It also provides many features that enable fast development for creating
outstanding applications.
3) ASP.NET Web Pages :-

It is used to create dynamic web pages. It provides fast and lightweight way to combine
server code with HTML.

It helps to add video, link to the social sites. It also provides other features like you can
create beautiful sites that confirm to the latest web standards.

All these are stable and well equipped frameworks. We can create web applications with
any of them. These are also based on the .NET Framework and share core functionalities of
.NET and ASP.NET.
• We can use any development style to create application.

• The selection of style is depends on the skills and experience of the programmer.

• Although each framework is independent to other, we can combine and use any of that
at any level of our application.

• For example, to develop client interaction module, we can use MVC and for data control,
we can use Web Forms.
The following table illustrates each
development model.
Q3. Explain ASP.NET Page Lifecycle.

• In ASP.NET, a web page has execution lifecycle that includes various


phases. These phases include initialization, instantiation, restoring
and maintaining state etc.

• it is required to understand the page lifecycle so that we can put


custom code at any stage to perform our business logic.
The following table contains the lifecycle
stages of ASP.NET web page.
PAGE EVENTS
1) Page_PreInit()

This event is used for following purpose :

Check the IsPostBack property to determine whether the page is being processed first time.
Create or re-create dynamic controls.

Set a master page dynamically.

Set the Theme property dynamically.

Read or set profile property values.


2) Page_Init() :
It is executed after the PreInit() event. It is use to retrieve or initialize
control properties.

3) Page_Preload():
Prior to this event, the ViewState and PostBack data are restored to the
controls.
This event is used if we want to do some task before load event is
executed.
4) Page_Load():
It calls the Load Event of the pages as well as each control on the page. This event is
used to set the properties of the controls and it can also be used to established
database connection.

5) Control_events :
They are useful to handle the events of the controls. EX:- Click event of the button.
6) Page_PreRender() :
It is executed for each control on the page. It is used to make final
changes to the page and its controls.

7) Page_Unload() :
It is executed for each control and then for the page. So we can say that
is useful for the final cleanup such as closing the connection, closing
the files, completing log etc.
Compiled Code
In order to serve the request given by the user, ASP.NET must first
compile the code. We can write the ASP.NET code in any of the
Language supported by .NET framework. When we compile the code.

It is translated into MSIL which is language- independent. Then this


MSIL is converted into machine- specific instructions.
Benefits of Compiled Code
• Stability :- When the code is complicated, it is checked for syntax
error, type safety, etc. So, that many errors can be eliminated from
the later stage.
• Performance :- The execution of the compiled code is faster then the
scripts such as VBScript which is much similar to the machine code.
• Security :- Complied code is difficult to read. So no one can convert
compiled code into source code.
• Interoperability :- We are able to use assemblies written in different
Languages as MSIL supports any .NET Language.
OBJECT ORIENTED CONCEPTS!
• Object- oriented programming (OOP) is a programming approach that
uses “objects” – data structure consisting of data fields and methods
and their interactions to design applications and computer programs.

• CLASS :- The class is a template through which we can create an


object. In .NET, it contains fields, properties, methods that is
procedure and functions and events.
• Access Modifiers :- Public, Private, Protected, Friend and Protected
Friend.
OBJECT ORIENTED CONCEPTS!
• Fields :- They are the variables in the class and they can be read or set
directly.

• Public class class1


Public field1 AS Integer
End CLass
OBJECT ORIENTED CONCEPTS!
• Properties :- Properties are retrieved and set like fields but are
implemented using property Get and property Set procedures which
provide more control on how values are set or returned.

• Methods :- Methods represent the object’s built-in procedures. For


example, a class named Emp may have methods named
ClaculateSalary and calculateLeave. We can define methods by adding
procedures, sub routines or functions to the class.
OBJECT ORIENTED CONCEPTS!
• Events :- Events allow objects to perform actions whenever a specific
occurrence takes place. For example when we click a button, a click
event occurs and we can handle that event using an event handler.

• Objects :- They are the basic runtime entities. They are the variables
of the class. It is said to be the instance of the class.
OBJECT ORIENTED CONCEPTS!
• Constructor :- They are the special procedure that are invoked
automatically for object creation.

• Destructor :- We Know how to create constructor, but what about


destructor, it is executed automatically when an object is destroyed.
We can place code to clean Up. Such saving state information and
closing files in a destructor.
• In VB.net you can use the Finalize method for this purpose. Finalize
method beeps when the object is destroyed.
OBJECT ORIENTED CONCEPTS!
• Encapsulation :-
The Process of uniting data members and methods in a single unit is
called Encapsulation. In other words, to combine data and functions
into a single logical unit is known as encapsulation.
When using data Encapsulation, data is not accessed directly; it is only
accessible through the functions present inside the class. Data
Encapsulation enables the important concept data data hiding.
Protecting data from access by unauthorized function is called data
hiding.
OBJECT ORIENTED CONCEPTS!
Inheritance :-
It is the process by which object of one class acquire the properties.
Data/attributes of object, of the another class.

That means inheritance is the process of forming a new class from an


existing class or base class.

The base class is also known as parent class or super class.


OBJECT ORIENTED CONCEPTS!
Inheritance :- The new class created from base class is called derived
class.
Derived class is called as child class or sub class.

Inheritance helps in reducing the overall code size of the program,


which is an important concept in OOPS.
OBJECT ORIENTED CONCEPTS!
Example :-
Public Class Person
‘members of person class
End Class

Public Class Employee


Inherits person ‘members of employee class
End class.
OBJECT ORIENTED CONCEPTS!
Abstraction :-
It is a mechanism of representing essential features without including
background details.

Data Abstraction increases the power of programming language by


creating user defined data types. Data Abstraction also represents the
needed information in the program with out presenting the details.
OBJECT ORIENTED CONCEPTS!
Abstract Class :-

MustInherit keyword is used to declare a class that cannot be intantited


and can be used only as a base class also called an Abstarct Base
class(ABC).
OBJECT ORIENTED CONCEPTS!
Interface : Interfaces can act as specifications for class members; when
you implement an interface, you also must implement all the specified
members.
If class wants to use the interface , it needs to use Implements
Keyword.

Multiple Inheritance : VB.NET does not support Multiple Inheritance,


Where we inherit from multiple base classes at the same time. But it
allows us to implements multiple Interfaces.
OBJECT ORIENTED CONCEPTS!
Polymorphism :-
It is a Greek word, poly means many and morphism means forms i.e
one name many forms.
The ability of functions and operations to act in different ways on
different data types is called polymorphism.
Overloading :- To use one function name for many different purposes is
called as function overloading.
Overloading is one type of polymorphism, it allows an object to have
different meanings, depending on its context.
OBJECT ORIENTED CONCEPTS!
Overloads function Add(Byval a1 as integer,byval a2 as Integer) AS Integer
Res=a1+a2
Return res
End Function
Overloads Function Add(Byval a1 As Integer, Byval a2 As Integer, Byval a3 As
Integer) As Integer
Res= a1+a2+a3
Return res
End Function.
OBJECT ORIENTED CONCEPTS!
Method Overriding :
The Process in which subclass provide a specific implementation of the
method, that is already provided by one of its super class is called
Method overriding.
The implementation in the subclass overrides(replaces) the
implementation in the superclass.
Keyword you can use :-
Overridable,overrides,NotOverridable,MustOverride.
Inline Code (In- Page Code)
 Traditional ASP developers were using this approach. In this approach
scripting code working for generating desired output was intermixed
with the HTML code to create user friendly pages as well as specific
functionality was added to the web pages.
 But often, the combined intermixed code become ambiguous for
maintaining the reliability of large web pages.
 For ASP. Net web pages, you can also use inline code but it becomes
difficult to maintain the server side events of all server controls on a
single page, The code is written in <script> tag in the .aspx page that
contains the HTML and controls.
Code Behind
 ASP.net framework provides a facility to maintain the code for large
pages by designing separate files for HTML code and the code file in
which we can write the code in VB or C# language.
 So this approach of developing the web pages is called Code Behind.
It separate the design layout and the coding part.
 The HTML and controls are in .aspx file and the code is in .aspx.vb or
aspx.cs file.
 A time of compilation both the files are combined and one class is
generated which is the used to serve the user request. Hence, we can
say that the web pages are in form of class. So when the page is
requested the instance of the page is served.
Event Driven Programming.
 There are two programming approaches : Linear and event Driven.
 Any identifiable occurrence that has significance for system hardware
or software is called event.
 So we can say that, Event is the action or the occurrence that is
detected by the program.
 User generated events include keystrokes and mouse clicks, among a
wide variety of other possibilities.
 The programming approach, which response to the event or handle
the event is called Event Driven Programming. Windows Operating
System is the Event Driven Program (EDP).

You might also like