Life Cycle of Asp.Net
Step-1: User requests an application resource from the Web server.
- Life cycle of an ASP.NET application starts with a request sent by a browser to the Web server, typically IIS
Step-2: ASP.NET receives the first request for the application.
- When ASP.NET receives the first request for any resource in an application, a class named ApplicationManager creates an application domain.

Step-3:ASP.NET core objects are created for each request.
- After the application domain has been created and the HostingEnvironment object instantiated, ASP.NET creates and initializes core objects such as
- When an instance of HttpApplication is created, any configured modules are also created. For instance, if the application is configured to do so, ASP.NET creates a SessionStateModule module. After all configured modules are created, theHttpApplication class's Init method is called.
Step-5: The request is processed by the HttpApplication pipeline
- In the HttpApplication pipeline the rewuest is processed in several stages and sends response to the client through HttpRespose.
Overview of ASP.Net Page Life Cycle:
- Page request
- Start
- Initialization
- Load
- Post-back event handling.
- Rendering
- Unload
---------------------------------
Differences between HTML and ASP.NET
HTML
|
ASP.NET
|
A simple ASP.NET page looks just like an
ordinary HTML page.
|
ASP.NET page
is just the same as an HTML page.
|
An HTML page
has the extension .htm.
|
An ASP.NET
page has the extension .aspx.
|
If a browser
requests an HTML page from the server, the server sends the page to the
browser without any modifications.
|
If a browser
requests an ASP.NET page, the server processes any executable code in the
page, before the result is sent back to the browser.
|
HTML is a client-side language
|
ASP is a
server side language
|
It is used to design static web pages
|
ASP is used to design user-interactive pages or
dynamic pages
|
HTML page cannot connect to the database
|
ASP and ASP.NET Pages can.
The content on an ASP.NET
page is derived from a data source, such as a database.
|
It cannot reuse the code
|
ASP.NET
allows one to use and create reusable complex html controls, using
programming languages.
|
---------------------------------
What is the Purpose of a model?
Model:
- Responsible for making all updates, calling Business and Data layers, loading all data
- Handles all validation and errors, and returns these to the Controller
- Contains properties of all data that is required for the
View, and populates itself. - The Models contain the business logic, represent the things in your application.
- The views present the data to the user.
- The controllers decide what to do with the various user actions. When you stick to that, the code is easy to read because things are as simple as possible.

- Simply, the model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).
---------------------------------
How do we call a model in Controller?
While Creating the controller, you will give name(default) name of the controller. Next select the template which you would like to use.
Then you can notice a Model class here you will specify which model class would be used to the current controller.
Here we can also specify the Data Context class.
For example please go through the link as follows:
Or by using assembly directives like
using Projectname.Models;
---------------------------------
No comments:
Post a Comment