0% found this document useful (0 votes)
74 views26 pages

ASP21052019

ASP.NET is a web framework developed by Microsoft for building web apps and services. It was first released in 2002 and allows programmers to write code using any .NET language. ASP.NET provides three development styles: Web Forms, MVC, and Web Pages. Web Forms uses an event-driven model while MVC enforces separation of concerns. ASP.NET apps can be created in Visual Studio using server and HTML controls, master pages, data binding, security features and more.

Uploaded by

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

ASP21052019

ASP.NET is a web framework developed by Microsoft for building web apps and services. It was first released in 2002 and allows programmers to write code using any .NET language. ASP.NET provides three development styles: Web Forms, MVC, and Web Pages. Web Forms uses an event-driven model while MVC enforces separation of concerns. ASP.NET apps can be created in Visual Studio using server and HTML controls, master pages, data binding, security features and more.

Uploaded by

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

Overview ASP.

Net
ASP.NET
It 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.

ASP.NET provides three development styles for creating web


applications:

1. Web Forms
2. ASP.NET MVC
3. ASP.NET Web Pages
Overview ASP.Net
ASP.NET
It 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.

ASP.NET provides three development styles for creating web


applications:

1. Web Forms
2. ASP.NET MVC
3. ASP.NET Web Pages
Overview ASP.Net
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.

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.
ASP.NET Page Lifecycle
Stage Description

Page request This stage occurs before the lifecycle begins. When a page is
requested by the user, ASP.NET parses and compiles that page.

Start In this stage, page properties such as Request and response are set.
It also determines the Request type.

Initialization In this stage, each control's UniqueID property is set. Master page is
applied to the page.
Load During this phase, if page request is postback, control properties are
loaded with information.
Postback event handling In this stage, event handler is called if page request is postback.
After that, the Validate method of all validator controls is called.

Rendering Before rendering, view state is saved for the page and all controls.
During the rendering stage, the page calls the Render method for
each control, providing a text writer that writes its output to the
OutputStream object of the page's Response property.

Unload At this stage the requested page has been fully rendered and is ready
to terminate.at this stage all properties are unloaded and cleanup is
performed.
ASP.NET Web Forms
Web Forms are web pages built on the ASP.NET Technology. 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. It is an IDE (Integrated
Development Environment) that allows us to drag and drop server controls to
the web forms. It also allows us to set properties, events and methods for the
controls. To write business logic, we can choose any .NET language like: Visual
Basic or Visual C#.

Web Forms are made up of two components: the visual portion (the ASPX file),
and the code behind the form, which resides in a separate class file.
ASP.NET Web Forms
Server Controls
Control Name Applicable Events Description

Label None It is used to display text on the HTML


page.

TextBox TextChanged It is used to create a text input in the


form.

Button Click, Command It is used to create a button.

LinkButton Click, Command It is used to create a button that


looks similar to the hyperlink.

ImageButton Click It is used to create an imagesButton.


Here, an image works as a Button.
HTML Controls
Controls Name Description

Button It is used to create HTML button.

Reset Button Resets all other HTML form elements on a form to


a default value

Submit Button Automatically POSTs the form data to the specified


page listed in the Action attribute in the FORM tag

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

Text Area Used for multi-line input on an HTML form


ASP.NET Web Forms Features
1. Server Controls
2. Master Pages
3. Working with data
4. Membership
5. Client Script and Client Frameworks
6. Routing
7. State Management
8. Security
9. Performance
10.Error Handling
ASP.NET Web Forms Features
Membership
Project's Account folder contains the files that implement the various parts of
membership: registering, logging in, changing a password, and authorizing access.
Additionally, ASP.NET Web Forms supports OAuth and OpenID. These authentication
enhancements allow users to log into your site using existing credentials, from such
accounts as Facebook, Twitter and Google.
Client Script and Client Frameworks
We can enhance the server-based features of ASP.NET by including client-script
functionality in ASP.NET Web Form pages. We can use client script to provide a richer,
more responsive user interface to the users. We can also use client script to make
asynchronous calls to the Web server while a page is running in the browser.
Routing
We can configure URL routing of our application. A request URL is simply the URL a user
enters into their browser to find a page on our web site. We use routing to define URLs
that are semantically meaningful to users and that can help with search-engine
optimization (SEO).
ASP.NET Web Forms Features
State Management
ASP.NET Web Forms includes several options that help you preserve data on both
a per-page basis and an application-wide basis.
Security
Developing a secure application is most important aspect of software development
process. ASP.NET Web Forms allow us to add extensibility points and configuration
options that enable us to customize various security behaviors in the application.

Performance

Web Forms provides good performance and allows us to modify performance


related to page and server control processing, state management, data access,
application configuration and loading, and efficient coding practices.
ASP.NET Web Forms Features
Debugging and Error Handling
We can diagnose problems that occur in our Web Forms application. Debugging and
error handling are well supported within ASP.NET Web Forms so that our
applications compile and run effectively.

ASP.NET Web Forms Project

We are using Visual studio 2017 to create web project. It includes the
following steps:
1.Creating a new project
Click on the file menu from the menu bar and select new -> project.
ASP.NET Web Forms Features
Debugging and Error Handling
We can diagnose problems that occur in our Web Forms application. Debugging and
error handling are well supported within ASP.NET Web Forms so that our
applications compile and run effectively.

ASP.NET Web Forms Project

We are using Visual studio 2017 to create web project. It includes the
following steps:
1.Creating a new project
Click on the file menu from the menu bar and select new -> project.
ASP.NET Web Forms Features
ASP.NET Web Forms Features
Select Project type

It provides couple of choices but we selecting ASP.NET Web Application.


ASP.NET Web Forms Features
Select Project Template
After selecting project types, now, it asks for the
type of template that we want to implement in our
application.
Here, we are selecting Web Forms as because we
are creating a Web Forms application.
ASP.NET Web Forms Features
After clicking ok, it shows project in solution
explorer window that looks like the below.
ASP.NET Web Forms Features
This project contains a default.aspx file which is a
startup file. When we run the project this file
executes first and display a home page of the site.
We can see its output on the browser by
selecting view in browser option as we did
below.
ASP.NET Web Forms Features
Finally, it shows output in the browser like this:

Well, we have created a project successfully and


running on the browser.

In next chapter, we will create a new web form


and link that within project.
Create a New Web Form
Here, we are using the project that we created in last topic. To
add a new web form in our existing project, first select project
then right click and add new item.
Create a New Web Form
ASP New web form 1
Select web forms option in left corner and then select web form and hit add
button.
Create a New Web Form
Now click on the add button and this form will add to our project.

After adding form, we can see that this is now in our project as we have shown in the below
image.

Double click on this form and this will show


some auto generated code like this:
Create a New Web Form
Double click on this form and this will show
some auto generated code like this:
Create a New Web Form
// user-form.aspx
1.<
%@ Page Language="C#"  AutoEventWireup="tru
e" CodeBehind="user-form.aspx.cs"  
2.Inherits="asp.netexample.user_form" %>  
3.<!DOCTYPE html>  
4.<html xmlns="http://www.w3.org/1999/xhtml"
>  
5.<head runat="server">  
6.<title></title>  
7.</head>  
8.<body>  
9.<form id="form1" runat="server">  
10.<div>  
11.</div>  
12.</form>  
13.</body>  
14.</html>  
Create a New Web Form
If we run this file on the browser, it does not show any output.
So, let's print some message by this form.
The modified code is as below.
The modified code is as below. // user-form.aspx
1.<
%@  Page Language="C#" AutoEventWireup="true" C
odeBehind="user-form.aspx.cs"  
2.Inherits="asp.netexample.user_form" %>  
3.<!DOCTYPE html>  
4.<html xmlns="http://www.w3.org/1999/xhtml">  
5.<head runat="server">  
6.<title></title>  
7.</head>  
8.<body>  
9.<form id="form1" runat="server">  
10.<div>  
11.<h2>Welcome to the Web Forms!</h2>  
12.</div>  
13.</form>  
14.</body>  
Create a New Web Form
After running it on the browser it yields the following output.

You might also like