2. What is ASP?
• ASP stands for Active Server Pages
• ASP is a Microsoft Technology
• ASP is a program that runs inside a web
server
• An ASP file is just the same as an HTML file
• An ASP file can contain server scripts in
addition to HTML
• Server scripts in an ASP file are executed
on the server
4. • ASP.NET is an open-source server-side web
application framework designed for web
development to produce dynamic web
pages.
• It was developed by Microsoft to
allow programmers to build dynamic web
sites, web applications and web services.
ASP.NET
5. ASP.NET Benefits
• Separate Presentation from code
• Object Oriented Approach
• Event Driven Architecture
• Code Compilation
• Built in State Management
• Many others (data binding, validation, master
page etc…)
7. • Client Browser request ASPX pages
• The webserver executes the ASPX page and
produce html + css + javascript
Using ASP.NET
• Simple Web Pages
• Web Forms
• MVC (model view controller)
• SignalR
8. ASP.NET Working
Traditional web pages
• Consist of static html, images, styles etc.
• Execute code on the client side
• Simple operations
ASP.NET Webforms
• Execute code on the server side
• Database access
• Dynamic Pages
• High Security level
9. Separate Presentation from code
In traditional web development, HTML and
programming code in one file
• Hard to read, understand
• Hard to test and debug
ASP.NET Splits web pages into two parts:
• .aspx file containing HTML
• Code-behind file contain the presentation logic
for the particular page
11. Steps to create simple ASP.NET Application
1.Start Visual Studio
2.Create “New website”
3.Add 2 text fields, 1 label, 1 button
4.Double click on the button
5.Add code to add numbers entered in text fields
6.Display the result in the label
12. ASP.NET Base Components
• Web Forms – Deliver ASP.NET user interface
• Web Control – the components the we can use
in our web application (eg:textbox)
• “Code-behind” – contains the server side code
• Web.config – Contains ASP.NET application
configuration
• Machine.config – contains configurations for all
applications in the server
• Global.asax – class containing application level
event handlers
13. ASP.NET Web Controls
ASP.NET Web controls are the smallest component part
Deliver fast and easy component-oriented development
process
HTML abstraction, but finally everything is HTML
<form runat="server" ID="frmMain">
<asp:button runat="server" ID="btn" Text="Click me!"
OnClick="btn_Click" />
</form>
14. Web.config
Main settings and configuration file for ASP.NET
Text based XML document
Defines:
Connection strings to any DB used by app
The default language for child pages
Whether debugging is allowed
15. Global.asax
Also known as ASP.NET application file
Located in the Web application root folder
Exposes application and session level events
Application_Start
Application_End
Session_Start
Session_End
etc…
19. Writing code in an ASP.NET Web form is done in
three ways:
Mixed code method
Inline code method
Code-behind method
20. Mixed Code Method
The code is in the same file as the web content, mixed with
the HTML code
This method is not recommended as the source code is hard
to read and maintain
Inline Code Method
The code is separated in a SCRIPT section in the same file
Code-Behind Method
A separate compiled file containing the program logic of the
page
Each web page has its own code-behind page
Has the same name as the web page to which it is attached
The file extension is .aspx.cs
The two files are built into one when the application is
started