Year End Sale: Get Upto 40% OFF on Live Training! Offer Ending in
D
H
M
S
Get Now
Introduction to ASP.NET

Introduction to ASP.NET

07 Jun 2024
Beginner
33.6K Views
3 min read

According to Microsoft, "ASP.NET is a technology for building powerful, dynamic Web applications and is part of the .NET Framework". In fact, ASP.NET is a programming framework used to develop web applications and web services. Basically, it is the next version of ASP. You can also read brief version history of ASP.NET in past article. It provides the easy way to build, deploy & run the web application on any browser.

Benefits of Asp.Net

  1. ASP.NET makes development simple and easy to maintain with event-driven and server side programming model.

  2. ASP.NET source code is executed on the server. The source code is complied first time the page is requested. The server serves the complied version of the page for use next time the page is requested.

  3. ASP.NET provides validations controls.

  4. The html produced by ASP.NET is sent back to the browser. The application code that we write is not sent back to the browser and is not stolen easily.

  5. In Asp.Net business logic(in .cs class file) and presentation logic(in .aspx file) are in separate files.

ASP.NET Page Life Cycle Events

At each stage of the page life cycle, the page raises some events, which could be coded. An event handler is basically a function or subroutine, bound to the event, using declarative attributes like Onclick or handle. Asp.Net 3.5 & 4.0 page life cycle has following events in sequence :

  1. PreInit

    It is is entry point of page life cycle. It checks IsPostBack property to check or recreate dynamic controls. In this we can set master pages dynamically & set and get profile property values.

  2. Init

    It is is raised after all controls of page are initilised and skin properties are set. It is used to read or initialise control properties.

  3. InitComplete

    This indicates that page is completely initialised.

  4. Preload

    This event is called before loading the page in the RAM(memory). If any processing on a control or on page is required we use it.

  5. Load

    This invokes the onload event of the page. In this we create connection to the database, get/set controls values and get/set view state values.

    ASP.NET Page Life Cycle Events

    Source: https://msdn.microsoft.com

  6. loadComplete

    This indicates that page is completely loaded into memory.

  7. Prender

    we use this event to make final changes to the controls or page before rendering it to the browser.

  8. SaveStateComplete

    View state of each control is saved before this event occurs. If we want to change the view state of any control then we use this event. This event can not be used to change the other properties of the controls.

  9. Render/PrenderComplete

    This indicates that page is completely rendered to the browser.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.

  10. Unload

    The Unload event is raised after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and cleanup is performed.We can use this event for closing files & database connection. This event occurs for each control.

Share Article
About Author
Shailendra Chauhan (Microsoft MVP, Founder & CEO at Scholarhat by DotNetTricks)

Shailendra Chauhan, Founder and CEO of ScholarHat by DotNetTricks, is a renowned expert in System Design, Software Architecture, Azure Cloud, .NET, Angular, React, Node.js, Microservices, DevOps, and Cross-Platform Mobile App Development. His skill set extends into emerging fields like Data Science, Python, Azure AI/ML, and Generative AI, making him a well-rounded expert who bridges traditional development frameworks with cutting-edge advancements. Recognized as a Microsoft Most Valuable Professional (MVP) for an impressive 9 consecutive years (2016–2024), he has consistently demonstrated excellence in delivering impactful solutions and inspiring learners.

Shailendra’s unique, hands-on training programs and bestselling books have empowered thousands of professionals to excel in their careers and crack tough interviews. A visionary leader, he continues to revolutionize technology education with his innovative approach.
Accept cookies & close this