SlideShare a Scribd company logo
1 of 24
• 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.
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.
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.
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).
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.

More Related Content

What's hot

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 EventsMohan Arumugam
 
SharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewSharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewRob 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 SecurityDarren Sim
 
ATG - Installing WebLogic Server
ATG - Installing WebLogic ServerATG - Installing WebLogic Server
ATG - Installing WebLogic ServerKeyur Shah
 
Rails
RailsRails
RailsSHC
 
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 2010Rob 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 365Kashif Imran
 
SPCA2013 - SharePoint Insanity Demystified
SPCA2013 - SharePoint Insanity DemystifiedSPCA2013 - SharePoint Insanity Demystified
SPCA2013 - SharePoint Insanity DemystifiedNCCOMMS
 
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 ModelPhil Wicklund
 
Asp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohraAsp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohraGajanand 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 LightswitchRob Windsor
 
Siebel Web Architecture
Siebel Web ArchitectureSiebel Web Architecture
Siebel Web ArchitectureRoman Agaev
 
Mule using Salesforce
Mule using SalesforceMule using Salesforce
Mule using SalesforceKhasim Cise
 

What's hot (20)

Spring WebApplication development
Spring WebApplication developmentSpring WebApplication development
Spring WebApplication development
 
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
 
SharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewSharePoint 2010 Application Development Overview
SharePoint 2010 Application Development Overview
 
Microsoft Azure
Microsoft AzureMicrosoft Azure
Microsoft Azure
 
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
 
Metadata API
Metadata  APIMetadata  API
Metadata API
 
Spring Basics
Spring BasicsSpring Basics
Spring Basics
 
ATG - Installing WebLogic Server
ATG - Installing WebLogic ServerATG - Installing WebLogic Server
ATG - Installing WebLogic Server
 
Rails
RailsRails
Rails
 
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...
 
Tutorial asp.net
Tutorial  asp.netTutorial  asp.net
Tutorial asp.net
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
 
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
 
SPCA2013 - SharePoint Insanity Demystified
SPCA2013 - SharePoint Insanity DemystifiedSPCA2013 - SharePoint Insanity Demystified
SPCA2013 - SharePoint Insanity Demystified
 
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...
 
SharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object ModelSharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object Model
 
Asp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohraAsp.net presentation by gajanand bohra
Asp.net presentation by 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
 
Siebel Web Architecture
Siebel Web ArchitectureSiebel Web Architecture
Siebel Web Architecture
 
Mule using Salesforce
Mule using SalesforceMule using Salesforce
Mule using Salesforce
 

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
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
 
Asp.net
Asp.netAsp.net
Asp.net
 
Asp interview Question and Answer
Asp interview Question and Answer Asp interview Question and Answer
Asp interview Question and Answer
 
15th june
15th june15th june
15th june
 
Programming web application
Programming web applicationProgramming web application
Programming web application
 
Asp.net
Asp.netAsp.net
Asp.net
 
Asp
AspAsp
Asp
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentals
 
ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1
 
ASP.NET Unit-2.pdf
ASP.NET Unit-2.pdfASP.NET Unit-2.pdf
ASP.NET Unit-2.pdf
 
Web techh
Web techhWeb techh
Web techh
 
Web tech
Web techWeb tech
Web tech
 
Web tech
Web techWeb tech
Web tech
 
Web tech
Web techWeb tech
Web tech
 
Asp.netrole
Asp.netroleAsp.netrole
Asp.netrole
 
NET_Training.pptx
NET_Training.pptxNET_Training.pptx
NET_Training.pptx
 
Asp dot net long
Asp dot net longAsp dot net long
Asp dot net long
 
Unit5 servlets
Unit5 servletsUnit5 servlets
Unit5 servlets
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
 

More from application developer (20)

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

Recently uploaded

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Recently uploaded (20)

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

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.
  • 4.
  • 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.
  • 9.
  • 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.
  • 11.
  • 12.
  • 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).
  • 23.
  • 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.