SlideShare a Scribd company logo
• Anatomy of an ASP.NET application
• ASP.NET file types
• ASP.NET application directories
• Introducing Server Controls
• HTML control classes
• The Page Class
• Application Events
• ASP.NET configuration
• The web.config file
• The Website Administration Tool (WAT)
• An ASP.NET application is a combination of files, pages,
  handlers, modules, and executable code that can be
  invoked from a virtual directory

• Every ASP.NET website or application shares a common
  set of resources and configuration settings.

• Web pages from other ASP.NET applications don’t share
  these resources, even if they’re on the same web server.

• Technically speaking, every ASP.NET application is
  executed inside a separate application domain.
• Every ASP.NET application is executed inside a separate
  application domain.

• Application domains are isolated areas in memory, and
  they ensure that even if one web application causes a
  fatal error, it’s unlikely to affect any other application

• Application domains restrict a web page in one
  application from accessing the in-memory information of
  another application.

• Each web application is maintained separately and has its
  own set of cached, application, and session data.
Chapter 5
File Name       Description
Ends with       ASP.NET web pages.
.aspx

Ends with       ASP.NET user controls
.ascx

web.config      XML based configuration file. Includes settings for customizing
                security, state management, memory management etc.

global.asax     Global application file. Contain global variables (that can be
                accessed from any web page in the web application) and
                react to global events
Ends with .cs   Code-behind files that contain C# code. Allow you to separate
                the application logic from the user interface of a web page.
Directory             Description
App_Browsers          Contains .browser files that ASP.NET uses to identify the
                      browsers that are using your application and determine
                      their capabilities.
App_Code              Contains source code files that are dynamically compiled
                      for use in your application.
App_GlobalResources   Directory is used in localization scenarios, when you need
                      to have a website in more than one language.
App_LocalResources    Contain resources are accessible to a specific page only.
App_WebReferences     Stores references to web services
App_Data              Stores data, including SQL Server Express database files
App_Themes            Stores the themes that are used to standardize and reuse
                      formatting in your web application.
Bin                   Contains all the compiled .NET components (DLLs) that
                      the ASP.NET web application uses.
ASP.NET actually provides two sets of server-side controls
that you can incorporate into your web forms.

HTML server controls: These are server-based equivalents
for standard HTML elements.

Web controls: These are similar to the HTML server controls,
but they provide a richer object model with a variety of
properties for style and formatting details
HTML server controls provide an object interface for
standard HTML elements. They provide three key features:

• They generate their own interface
• They retain their state
• They fire server-side events

HTML server controls are ideal when you’re performing a
quick translation to add server-side code to an existing
HTML page. That’s the task you’ll tackle in the next section,
with a simple one-page web application.
Chapter 5
All the HTML server controls are defined in the System.Web.UI.HtmlControls
namespace. Each kind of control has a separate class.

    Class Name             HTML Element
    HtmlForm               <form>
    HtmlAnchor             <a>
    HtmlImage              <img>
    HtmlTable              <table><tr><td><th>
    HtmlInputButton        <input type=“button”>
    HtmlTextArea           <textarea>
    HtmlInputText          <input type=“text”>
    HtmlInputRadioButton   <input type=“radio”>
    HtmlInputCheckBox      <input type=“checkbox”>
    HtmlSelect             <select>
    HtmlHead               <head>
    HtmlGenericControl     Represents a variety of HTML elements that
                           don’t have dedicated control classes.
Chapter 5
Chapter 5
Every web page is a custom class that inherits from System.Web.UI.Page.
By inheriting from this class, your web page class acquires a number of
properties and methods that your code can use.


 Property          Description
 IsPostBack        This Boolean property indicates whether this is the first
                   time the page is being run (false) or whether the page is
                   being resubmitted in response to a control event
 EnableViewState   Maintain state information
 Application       This collection holds information that’s shared between all
                   users in your website.
 Session           This collection holds information for a single user, so it can
                   be used in different pages.
 Cache             This collection allows you to store objects that are time-
                   consuming to create so
                   they can be reused in other pages or for other clients.
Basic Page Properties


Property     Description
Request      This refers to an HttpRequest object that contains
             information about the current web request.
Response     This refers to an HttpResponse object that represents the
             response ASP.NET will send to the user’s browser.
Server       This refers to an HttpServerUtility object that allows you to
             perform a few miscellaneous tasks.
User         If the user has been authenticated, this property will be
             initialized with user information
Application Events are used to write logging code that runs
every time a request is received, no matter what page is
being requested.

Basic ASP.NET features like session state and authentication
use application events

The global.asax file handles application events.
Event Handling Method        Description
Application_Start()          Occurs when the application starts, which is the first
                             time it receives a request from any user. It doesn’t
                             occur on subsequent requests. Commonly used to
                             create or cache some initial information that will be
                             reused later.
Application_End()            Occurs when the application is shutting down. You can
                             insert cleanup code here.
Application_BeginRequest()   Occurs just before the page code is executed
Application_EndRequest()     Occurs just after the page code is executed
Session_Start()              Occurs whenever a new user request is received and
                             a session is started.
Session_End()                Occurs when a session times out or is
                             programmatically ended
Application_Error()          Occurs in response to an unhandled error.
The global.asax file allows you to write code that responds
to global application events. These events fire at various
points during the lifetime of a web application, including
when the application domain is first created (when the first
request is received for a page in your website folder).

When you add the global.asax file, Visual Studio inserts
several ready-made application event handlers. You simply
need to fill in some code.
Can be performed through web.configuration file.

Every web application includes a web.config file that configures
fundamental settings.

The ASP.NET configuration files have several key advantages:

   •   They are never locked
   •   They are easily accessed and replicated
   •   The settings are easy to edit and understand
Every web server starts with some basic settings that are
defined in a directory such as

c:WindowsMicrosoft.NETFramework[Version]Config.

The Config folder contains two files, named machine.config and
web.config. Generally, you won’t edit either of these files by
hand, because they affect the entire computer.

 Instead, you’ll configure the web.config file in your web
application folder. Using that file, you can set additional settings
or override the defaults that are configured in the two system
files.
You need to create additional subdirectories inside your virtual directory.
These subdirectories can contain their own web.config files with additional
settings. Subdirectories inherit web.config settings from the parent directory.
The web.config file uses a predefined XML format. The
entire content of the file is nested in a root
<configuration> element. Inside this element three important
subsections:

<?xml version="1.0" ?>
<configuration>
<appSettings> <!-- Custom application settings go here. -->
</appSettings>
<connectionStrings> <!-- ASP.NET Configuration sections go
here. --> </connectionStrings>
<system.web> <compilation debug="true"
targetFramework="4.0"></compilation> </system.web>
</configuration>
Editing the web.config file by hand is refreshingly
straightforward, but it can be a bit tedious. To help
alleviate the drudgery, ASP.NET includes a graphical
configuration tool called the Website Administration Tool
(WAT), which lets you configure various parts of the
web.config file using a web page interface.

To run the WAT to configure the current web project in
Visual Studio, select Website ➤ ASP.NET Configuration
(or click the ASP.NET Configuration icon that’s at the top
of the Solution Explorer).
Chapter 5
This chapter presented you with your first look at web
applications, web pages, and configuration.

You should now understand how to create an ASP.NET web
page and use HTML server controls.

HTML controls are a compromise between ASP.NET web
controls and traditional HTML. They use the familiar HTML
elements but provide a limited object-oriented interface.

In the next chapter, you’ll learn about web controls, which
provide a more sophisticated object interface that abstracts
away the underlying HTML.
Ad

More Related Content

What's hot (20)

Spring WebApplication development
Spring WebApplication developmentSpring WebApplication development
Spring WebApplication development
ThirupathiReddy Vajjala
 
SharePoint Object Model, Web Services and Events
SharePoint Object Model, Web Services and EventsSharePoint Object Model, Web Services and Events
SharePoint Object Model, Web Services and Events
Mohan Arumugam
 
SharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewSharePoint 2010 Application Development Overview
SharePoint 2010 Application Development Overview
Rob Windsor
 
Microsoft Azure
Microsoft AzureMicrosoft Azure
Microsoft Azure
Dima Maleev
 
C# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access SecurityC# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access Security
Darren Sim
 
Metadata API
Metadata  APIMetadata  API
Metadata API
Cloud Analogy
 
Spring Basics
Spring BasicsSpring Basics
Spring Basics
ThirupathiReddy Vajjala
 
ATG - Installing WebLogic Server
ATG - Installing WebLogic ServerATG - Installing WebLogic Server
ATG - Installing WebLogic Server
Keyur Shah
 
Rails
RailsRails
Rails
SHC
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
SharePoint Saturday NY
 
Tutorial asp.net
Tutorial  asp.netTutorial  asp.net
Tutorial asp.net
Vivek K. Singh
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
Rob Windsor
 
Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365
Kashif Imran
 
SPCA2013 - SharePoint Insanity Demystified
SPCA2013 - SharePoint Insanity DemystifiedSPCA2013 - SharePoint Insanity Demystified
SPCA2013 - SharePoint Insanity Demystified
NCCOMMS
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
SPTechCon
 
SharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object ModelSharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object Model
Phil Wicklund
 
Asp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohraAsp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohra
Gajanand Bohra
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchIntegrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio Lightswitch
Rob Windsor
 
Siebel Web Architecture
Siebel Web ArchitectureSiebel Web Architecture
Siebel Web Architecture
Roman Agaev
 
Mule using Salesforce
Mule using SalesforceMule using Salesforce
Mule using Salesforce
Khasim Cise
 
SharePoint Object Model, Web Services and Events
SharePoint Object Model, Web Services and EventsSharePoint Object Model, Web Services and Events
SharePoint Object Model, Web Services and Events
Mohan Arumugam
 
SharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewSharePoint 2010 Application Development Overview
SharePoint 2010 Application Development Overview
Rob Windsor
 
C# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access SecurityC# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access Security
Darren Sim
 
ATG - Installing WebLogic Server
ATG - Installing WebLogic ServerATG - Installing WebLogic Server
ATG - Installing WebLogic Server
Keyur Shah
 
Rails
RailsRails
Rails
SHC
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
SharePoint Saturday NY
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
Rob Windsor
 
Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365
Kashif Imran
 
SPCA2013 - SharePoint Insanity Demystified
SPCA2013 - SharePoint Insanity DemystifiedSPCA2013 - SharePoint Insanity Demystified
SPCA2013 - SharePoint Insanity Demystified
NCCOMMS
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
SPTechCon
 
SharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object ModelSharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object Model
Phil Wicklund
 
Asp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohraAsp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohra
Gajanand Bohra
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchIntegrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio Lightswitch
Rob Windsor
 
Siebel Web Architecture
Siebel Web ArchitectureSiebel Web Architecture
Siebel Web Architecture
Roman Agaev
 
Mule using Salesforce
Mule using SalesforceMule using Salesforce
Mule using Salesforce
Khasim Cise
 

Similar to Chapter 5 (20)

Asp.net+interview+questions+and+answers
Asp.net+interview+questions+and+answersAsp.net+interview+questions+and+answers
Asp.net+interview+questions+and+answers
Mohan Raj
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
Iblesoft
 
Asp.net
Asp.netAsp.net
Asp.net
OpenSource Technologies Pvt. Ltd.
 
Asp interview Question and Answer
Asp interview Question and Answer Asp interview Question and Answer
Asp interview Question and Answer
home
 
15th june
15th june15th june
15th june
Rahat Khanna a.k.a mAppMechanic
 
Programming web application
Programming web applicationProgramming web application
Programming web application
aspnet123
 
Asp.net
Asp.netAsp.net
Asp.net
vijilakshmi51
 
Asp
AspAsp
Asp
Kundan Kumar Pandey
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentals
Gopal Ji Singh
 
ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1
Neeraj Mathur
 
ASP.NET Unit-2.pdf
ASP.NET Unit-2.pdfASP.NET Unit-2.pdf
ASP.NET Unit-2.pdf
abiraman7
 
Web tech
Web techWeb tech
Web tech
SangeethaSasi1
 
Web tech
Web techWeb tech
Web tech
SangeethaSasi1
 
Web techh
Web techhWeb techh
Web techh
SangeethaSasi1
 
Web tech
Web techWeb tech
Web tech
SangeethaSasi1
 
Asp.netrole
Asp.netroleAsp.netrole
Asp.netrole
mani bhushan
 
NET_Training.pptx
NET_Training.pptxNET_Training.pptx
NET_Training.pptx
ssuserc28c7c1
 
Asp dot net long
Asp dot net longAsp dot net long
Asp dot net long
Amelina Ahmeti
 
Unit5 servlets
Unit5 servletsUnit5 servlets
Unit5 servlets
Praveen Yadav
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
Vivek Singh Chandel
 
Ad

More from application developer (20)

Chapter 26
Chapter 26Chapter 26
Chapter 26
application developer
 
Chapter 25
Chapter 25Chapter 25
Chapter 25
application developer
 
Chapter 23
Chapter 23Chapter 23
Chapter 23
application developer
 
Next step job board (Assignment)
Next step job board (Assignment)Next step job board (Assignment)
Next step job board (Assignment)
application developer
 
Chapter 19
Chapter 19Chapter 19
Chapter 19
application developer
 
Chapter 18
Chapter 18Chapter 18
Chapter 18
application developer
 
Chapter 17
Chapter 17Chapter 17
Chapter 17
application developer
 
Chapter 16
Chapter 16Chapter 16
Chapter 16
application developer
 
Week 3 assignment
Week 3 assignmentWeek 3 assignment
Week 3 assignment
application developer
 
Chapter 15
Chapter 15Chapter 15
Chapter 15
application developer
 
Chapter 14
Chapter 14Chapter 14
Chapter 14
application developer
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
application developer
 
Chapter 12
Chapter 12Chapter 12
Chapter 12
application developer
 
Chapter 11
Chapter 11Chapter 11
Chapter 11
application developer
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
application developer
 
C # test paper
C # test paperC # test paper
C # test paper
application developer
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
application developer
 
Chapter 8 part2
Chapter 8   part2Chapter 8   part2
Chapter 8 part2
application developer
 
Chapter 8 part1
Chapter 8   part1Chapter 8   part1
Chapter 8 part1
application developer
 
Ad

Recently uploaded (20)

Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Asthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdfAsthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdf
VanessaRaudez
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Image processinglab image processing image processing
Image processinglab image processing  image processingImage processinglab image processing  image processing
Image processinglab image processing image processing
RaghadHany
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical DebtBuckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Lynda Kane
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Asthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdfAsthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdf
VanessaRaudez
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Image processinglab image processing image processing
Image processinglab image processing  image processingImage processinglab image processing  image processing
Image processinglab image processing image processing
RaghadHany
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical DebtBuckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Lynda Kane
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 

Chapter 5

  • 1. • Anatomy of an ASP.NET application • ASP.NET file types • ASP.NET application directories • Introducing Server Controls • HTML control classes • The Page Class • Application Events • ASP.NET configuration • The web.config file • The Website Administration Tool (WAT)
  • 2. • An ASP.NET application is a combination of files, pages, handlers, modules, and executable code that can be invoked from a virtual directory • Every ASP.NET website or application shares a common set of resources and configuration settings. • Web pages from other ASP.NET applications don’t share these resources, even if they’re on the same web server. • Technically speaking, every ASP.NET application is executed inside a separate application domain.
  • 3. • Every ASP.NET application is executed inside a separate application domain. • Application domains are isolated areas in memory, and they ensure that even if one web application causes a fatal error, it’s unlikely to affect any other application • Application domains restrict a web page in one application from accessing the in-memory information of another application. • Each web application is maintained separately and has its own set of cached, application, and session data.
  • 5. File Name Description Ends with ASP.NET web pages. .aspx Ends with ASP.NET user controls .ascx web.config XML based configuration file. Includes settings for customizing security, state management, memory management etc. global.asax Global application file. Contain global variables (that can be accessed from any web page in the web application) and react to global events Ends with .cs Code-behind files that contain C# code. Allow you to separate the application logic from the user interface of a web page.
  • 6. Directory Description App_Browsers Contains .browser files that ASP.NET uses to identify the browsers that are using your application and determine their capabilities. App_Code Contains source code files that are dynamically compiled for use in your application. App_GlobalResources Directory is used in localization scenarios, when you need to have a website in more than one language. App_LocalResources Contain resources are accessible to a specific page only. App_WebReferences Stores references to web services App_Data Stores data, including SQL Server Express database files App_Themes Stores the themes that are used to standardize and reuse formatting in your web application. Bin Contains all the compiled .NET components (DLLs) that the ASP.NET web application uses.
  • 7. ASP.NET actually provides two sets of server-side controls that you can incorporate into your web forms. HTML server controls: These are server-based equivalents for standard HTML elements. Web controls: These are similar to the HTML server controls, but they provide a richer object model with a variety of properties for style and formatting details
  • 8. HTML server controls provide an object interface for standard HTML elements. They provide three key features: • They generate their own interface • They retain their state • They fire server-side events HTML server controls are ideal when you’re performing a quick translation to add server-side code to an existing HTML page. That’s the task you’ll tackle in the next section, with a simple one-page web application.
  • 10. All the HTML server controls are defined in the System.Web.UI.HtmlControls namespace. Each kind of control has a separate class. Class Name HTML Element HtmlForm <form> HtmlAnchor <a> HtmlImage <img> HtmlTable <table><tr><td><th> HtmlInputButton <input type=“button”> HtmlTextArea <textarea> HtmlInputText <input type=“text”> HtmlInputRadioButton <input type=“radio”> HtmlInputCheckBox <input type=“checkbox”> HtmlSelect <select> HtmlHead <head> HtmlGenericControl Represents a variety of HTML elements that don’t have dedicated control classes.
  • 13. Every web page is a custom class that inherits from System.Web.UI.Page. By inheriting from this class, your web page class acquires a number of properties and methods that your code can use. Property Description IsPostBack This Boolean property indicates whether this is the first time the page is being run (false) or whether the page is being resubmitted in response to a control event EnableViewState Maintain state information Application This collection holds information that’s shared between all users in your website. Session This collection holds information for a single user, so it can be used in different pages. Cache This collection allows you to store objects that are time- consuming to create so they can be reused in other pages or for other clients.
  • 14. Basic Page Properties Property Description Request This refers to an HttpRequest object that contains information about the current web request. Response This refers to an HttpResponse object that represents the response ASP.NET will send to the user’s browser. Server This refers to an HttpServerUtility object that allows you to perform a few miscellaneous tasks. User If the user has been authenticated, this property will be initialized with user information
  • 15. Application Events are used to write logging code that runs every time a request is received, no matter what page is being requested. Basic ASP.NET features like session state and authentication use application events The global.asax file handles application events.
  • 16. Event Handling Method Description Application_Start() Occurs when the application starts, which is the first time it receives a request from any user. It doesn’t occur on subsequent requests. Commonly used to create or cache some initial information that will be reused later. Application_End() Occurs when the application is shutting down. You can insert cleanup code here. Application_BeginRequest() Occurs just before the page code is executed Application_EndRequest() Occurs just after the page code is executed Session_Start() Occurs whenever a new user request is received and a session is started. Session_End() Occurs when a session times out or is programmatically ended Application_Error() Occurs in response to an unhandled error.
  • 17. The global.asax file allows you to write code that responds to global application events. These events fire at various points during the lifetime of a web application, including when the application domain is first created (when the first request is received for a page in your website folder). When you add the global.asax file, Visual Studio inserts several ready-made application event handlers. You simply need to fill in some code.
  • 18. Can be performed through web.configuration file. Every web application includes a web.config file that configures fundamental settings. The ASP.NET configuration files have several key advantages: • They are never locked • They are easily accessed and replicated • The settings are easy to edit and understand
  • 19. Every web server starts with some basic settings that are defined in a directory such as c:WindowsMicrosoft.NETFramework[Version]Config. The Config folder contains two files, named machine.config and web.config. Generally, you won’t edit either of these files by hand, because they affect the entire computer. Instead, you’ll configure the web.config file in your web application folder. Using that file, you can set additional settings or override the defaults that are configured in the two system files.
  • 20. You need to create additional subdirectories inside your virtual directory. These subdirectories can contain their own web.config files with additional settings. Subdirectories inherit web.config settings from the parent directory.
  • 21. The web.config file uses a predefined XML format. The entire content of the file is nested in a root <configuration> element. Inside this element three important subsections: <?xml version="1.0" ?> <configuration> <appSettings> <!-- Custom application settings go here. --> </appSettings> <connectionStrings> <!-- ASP.NET Configuration sections go here. --> </connectionStrings> <system.web> <compilation debug="true" targetFramework="4.0"></compilation> </system.web> </configuration>
  • 22. Editing the web.config file by hand is refreshingly straightforward, but it can be a bit tedious. To help alleviate the drudgery, ASP.NET includes a graphical configuration tool called the Website Administration Tool (WAT), which lets you configure various parts of the web.config file using a web page interface. To run the WAT to configure the current web project in Visual Studio, select Website ➤ ASP.NET Configuration (or click the ASP.NET Configuration icon that’s at the top of the Solution Explorer).
  • 24. This chapter presented you with your first look at web applications, web pages, and configuration. You should now understand how to create an ASP.NET web page and use HTML server controls. HTML controls are a compromise between ASP.NET web controls and traditional HTML. They use the familiar HTML elements but provide a limited object-oriented interface. In the next chapter, you’ll learn about web controls, which provide a more sophisticated object interface that abstracts away the underlying HTML.