Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

UNIT – 4

Building .NET Framework Applications

Introduction to ASP .NET,


Differentiate classic ASP and ASP .NET,
Asp.net- Life Cycle,
Asp.net state management,

Web application,
Web forms,
Controls in web forms,
Events in Web form,
Form validations - Client side, Server side.
Q1. Write the two differences between windows application and web
application. Mca2022 2no.
Q2. What is the full form of MVC in ASP.NET?
Q1. Explain mouse mased events with example.
Q2. Write the differences between client side and server side.
Q1. Describe various controls in web forms.

Q1. Mca2021 2no.


Q2.
Q1.
Q2.
Q1. What are the data controls available in ASP.NET.

Q1. What are the different types of coookies in ASP.NET. MCA2021 5 th


2no.
Q2. What is SOAP.
Q3. What are the advanced features of asp.net?
Q4. Give some examples of web controls.
Q5. What are the different validaters in asp.net.
Q1. What are the different modes for the session state in ASP.NET.
Q2.
Q1. Explain Form validation with proper program and output.

Q1. Explain state management in ASP.NET. MCA2020 5th.


Q2. Explain the difference between server-side and client-side code?
Q1.
Q2.
Q1. What are web server controls in ASP.NET and what are the various
way to authentication techniques in asp.net?
Q1. Differentiate classic Asp and Asp.net.Msc2022 2no.
Q2.
Q1. What is ASP.NET? What are its features?
Q2. Differentiate verification and validation in web forms.
Q1. Describe web form? Explain various control and events in web
form.
Or
What is form validation? Explain server side and client side validation.
Introduction to ASP .NET: -
 ASP.NET is a web application framework designed and developed by Microsoft.
 ASP.NET is open source and a subset of the .NET Framework and successor of
the classic ASP (Active Server Pages).
 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.

Differentiate classic ASP and ASP .NET: -

ASP ASP.NET

ASP is the interpreted language. ASP.NET is the compiled language.

ASP uses ADO (ActiveX Data Objects)


ASP.NET uses ADO.NET to
technology to connect and work with
connect and work with databases.
databases.

ASP is partially object-oriented. ASP.NET is fully object-oriented.

ASP.NET Pages have the file


ASP Pages have the file extension .asp.
extension .aspx.

ASP.NET inherit the class written in


ASP doesn’t have the concept of inheritance.
code behind.

ASP.NET uses a full-fledged


ASP pages use scripting language.
programming language.

Error handling is very good in


Error handling is very poor in ASP.
ASP.NET.

In ASP debugging is difficult because the


In ASP.NET debugging is easy.
ASP scripts are interpreted.
ASP ASP.NET

In ASP.NET Web.config is used for


ASP is not a configurable language.
configuration.

Asp.net- Life Cycle: -


 The ASP.NET life cycle is very crucial to developing applications.
 It includes various stages that help to produce dynamic output.

The Life Cycle of ASP.NET is divided into two categories:

1. Application Life Cycle

2. Page Life Cycle

Application Life Cycle

The application life cycle contains the following steps:

1. Application Start

The webserver executes the application start when a user requests an application for access.
In this method, it sets all global variables to default.

2. Object Creation

Object creation holds all the HTTP Context, HTTP Request, and HTTP Response by the
webserver. It also contains information about the request, cookies, and browsing information.
3. HTTP Application

HTTP Application is an object created by the webserver. It helps to process all the
subsequent information that is sent to the user.

4. Dispose

Dispose is an event that is called before the application is destroyed. It also helps to release
manually unmanaged resources when the objects are no longer needed.

5. Application End

Application End is the last stage of the application life cycle. It helps to unload the memory.

Page Life Cycle

The Page Life Cycle has certain phases that help in writing custom controls and initializing
an application.

Following are the different phases of the Page Life Cycle:


1. Page Request

Page Request is the first step of the page life cycle. When a user request is made, the server
checks the request and compiles the pages. Once the compilation is done, the request is sent
back to the user.

2. Page Start

Page Start helps in creating two objects: request and response. The request holds all the
information which the user sent, while the response contains all the information that is sent
back to the user.

3. Page Initialization

Page Initialization helps to set all the controls on the pages. It has a separate ID, and it applies
themes to the pages in this step.
4. Page Load

Page Load helps to load all the control properties of an application. It also helps to provide
information using view state and control state.

5. Validation

Validation happens when the execution of an application is successful. It returns two


conditions: true and false. If execution is successful, it returns true, otherwise false.

6. Event Handling

Event Handling takes place when the same pages are loaded. It is a response for the
validation.

7. Rendering

Rendering happens before it sends all the information back to the user.

8. Unload

Unload is a process that helps in deleting all unwanted information from the memory once
the output is sent to the user.

Asp.net state management: -


 In an ASP NET application, state management in ASP NET is an object and
preserves type state control. This is because ASP NET applications are
basically stateless.

 State Management maintains and stores the information of any user till the
end of the user session.

 State management can be classified into two types.

 Server side state management

 Client side state management

Server side state management: -


1. Application State: This is mainly used to store user activity in server
memory and application events.
2. Session State: Session is a very important technique to maintain
state. Normally session is used to store information and identity.

3. Profile Properties: This option also allows saving of user specific data.

4. Cache: it is used to implement page caching and data caching. A cache is primarily used to set
expiration policies.

Client side state management: -


1. View State: It is used to manage page-level state and is used for storing,
sending, and receiving information.

2. Control State: It is a technique used to maintain data work in order,


properly. We use Control State to use the view state without the
possibility of it being disabled by the user.

3. Hidden Field: This field is used to store values on the client-side. The
hidden field works on request and is not displayed on the browser.

4. Cookies: Cookie is a small amount of information that is stored in


client machine.

5. Query String: Query String contains the information that is sent to


server with URL.

Web application: -
 A web application is a type of computer program stored on a remote
server, accessible to users through a web browser.
 It utilizes various web technologies to perform tasks over the internet.

 A web application can be developed for several uses, which can be used by
anyone like it can be used as an individual or as a whole organization for
several reasons.

 Commonly used web applications can include webmail, online


calculators or e-commerce shops.

 There is also some kind of web application that usually requires a special
kind of web browser to access them.

 However, most of the web applications available on the internet can be


accessed using a standard web browser.

Web forms: -
 Web Forms is a part of the ASP.NET framework that facilitates the creation
of dynamic web pages and web applications.
 Web Forms are web pages that are requested by your users through their
browser.
 HTML, client-script, server controls, and server code can all be used to
create these pages.
 It executes on the server and generates output to the browser.
 It is compatible to any browser to any language supported by .NET
common language runtime.
 It is flexible and allows us to create and add custom controls.
 We can use Visual Studio to create ASP.NET Web Forms.

Controls in web forms: -


 Controls in web forms are the building blocks that allow developers to
create interactive and dynamic user interfaces.
There are two main types of controls:
1. HTML Controls:
 Basic HTML elements like textboxes, buttons, checkboxes, and
radio buttons.
 Lightweight and rendered as HTML elements on the client side.
 Example include:
 Textbox: Basic input control for text.
 Button: Represents a clickable button.
 CheckBox: Allows user to select one or more options.
 RadioButton: Similar to a checkbox but allows only one option to
be selected in a group.

HTML Controls
These controls render by the browser. We can also make HTML controls as server
control.

Controls Description
Name

TextBox Basic input control for text.

CheckBox Allows user to select one or more options.

Button Represent a clickable button.

Radio Button Similar to a checkbox but allows only one option to be


selected in a group

Text Field Gives the user an input area on an HTML form

Table Allows you to present information in a tabular format

Image Displays an image on an HTML form

2. Server Controls:
 Server-side controls provided by ASP.NET, such as TextBox,
Button,DropDownList, GridView, etc.
 Server Controls are more powerful and provide additional
features.
 Example include:
 TextBox: Input control for text.
 Button: Triggering events on the server.
 DropDownList: Selecting from a list of items.
 GridView: Displays and allows editing of tabular data.
 Calender: Allows users to select dates.
 FileUpload: Enables file uploads from the client to the server.

Server Controls

Control Description
Name

Label It is used to display text on the HTML page.

TextBox It is used to create a text input in the form.

CheckBox It is used to create checkbox.

Button It is used to create a button.

RadioButton It is used to create radio button.

ImageButton It is used to create an imagesButton. Here, an image


works as a Button.

Calendar It is used to create a calendar. We can set the default


date, move forward and backward etc.

XML It is used to display XML documents within the HTML.

Events in Web form: -


 In web forms, event play a crucial role in responding to use interactions and
executing server-side logic.
 Events in Web Forms are actions or occurrences that happen during the
execution of a web page.
 Some common events include:
1. Button Click Event:
 Triggered when a button control is clicked.
2. TextChanged Event:
 Raised when the text in a TextBox control changes.
3. DropDownList SelectedIndexChanged Event:
 Fired when the selected item in a DropDownList changes.
4. Page Load Event:
 Occurs when the page is loaded, whether it’s the initial load or a
postback.
5. Page PreRender Event:
 Raised just before the page is rendered, allowing for final
modifications.

Form validations - Client side, Server side.


 Form validations is a crucial aspect of web development that ensures
user input is accurate, complete, and secure.
 The primary goals of form validation are to enhance user experience,
ensure data accuracy, and improve overall application security.
 Validating user input helps prevent errors and enhance the user
interface.
 Form validation can be implemented on both the client side (using
JavaScript in the user’s browser) and the server side (on the web
server).
 Client-side validation offer immediate feedback to users, enhancing
the user experience.
 While server-side validation ensures data integrity and security by
validating input on the server before processing.

Client side
 Client-side form validation is performed on the user’s device (browser)
before the data is submitted to the server.
 It enhances the user experience by providing immediate feedback.
 JavaScript is commonly used for implementing client-side validations.
 This approach improves responsiveness and makes the validation
process more user-friendly.
 Client-side validation is convenient but should not be solely relied upon
for security.

Server side
 Server-side validation is performed on the server after the form data is
submitted.
 It is a crucial step to ensure data integrity and security.
 It ensures that only valid and accepted data is processed on the server.
 Server-side validation is essential because client-side validation can be
bypassed.
 It provides more security for data.
Client-side Validation Server-side Validation

Source code is not visible to the


Source code is visible to the user. user .

 It enhances the user experience by  It is a crucial step to ensure


providing immediate feedback. data integrity and security.

Relies on user device resources (CPU,


Utilizes server resources.
memory)

It runs on the user’s computer. It runs on the webserver.

It does not provide security for data. It provides more security for data.

HTML, CSS, and javascript are used. PHP, Python, Java, Ruby are used.

It is all about interacting with the


No need of interaction with the server.
servers.

It reduces load on processing unit of the It surge the processing load on the
server. server.

You might also like