asp.net session 20
TRANSCRIPT
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 1/30
Slide 1 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
In this session, you will learn to:
Monitor Web applications
Create mobile Web pages
Render content on mobile Web pages
Objectives
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 2/30
Slide 2 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
After deploying a Web application, a System Administrator
needs to constantly monitor the application for its proper
functioning.
By monitoring a Web application, you can detect the
problems occurring in the application and troubleshootthem.
Monitoring and troubleshooting are required to improve the
performance of a Web application.
To help you track monitor a Web application, ASP.NET
provides you with the following two features:Health monitoring
Performance monitoring
Monitoring Web Applications
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 3/30
Slide 3 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
ASP.NET health monitoring system:
Enables you to monitor the status of the deployed Web
applications.
Is used to track system events and errors, which can hamper
the performance of a Web application.
Enables you to get the detailed run-time information about
ASP.NET resources used by a Web application.
Is implemented by using the System.Web.Management
namespace.
Health Monitoring
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 4/30
Slide 4 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
You can configure applications to use built-in or customized
monitoring providers.
To use the health monitoring system you need to:
Configure and enable Web events to monitor.
Configure and enable event providers that listen for andprocess various Web events.
Web events contain information about the health of a Web
application.
Health Monitoring (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 5/30
Slide 5 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
There are several events that you can trap to monitor the
health of a Web application. Some of the important events
are:
WebBaseEvent
WebBaseErrorEvent
WebHeartbeatEvent
WebRequestEvent
WebErrorEvent
WebApplicationLifetimeEvent
WebRequestErrorEventWebAuditEvent
WebFailureAuditEvent
Health Monitoring (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 6/30
Slide 6 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
The event providers are used to listen for Web events that
are raised by a Web application. Some of the built-in
providers are:
EventLogWebEventProvider
SqlWebEventProvider
SimpleMailWebEventProvider and
TemplatedMailWebEventProvider
TraceWebEventProvider
WmiWebEventProvider
Health Monitoring (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 7/30Slide 7 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
Performance is an important factor in making a Web
application or project successful.
You need to monitor a Web application to troubleshoot any
performance-related issues.
You need to keep a track of such errors to improve theperformance of your Web application.
ASP.NET provides you with several performance counters,
such as Application Restarts, Requests Queued, and Errors
Total to help you keep track of the execution of your Web
application.
Performance Monitoring
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 8/30Slide 8 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
ASP.NET supports the following two groups of performance
counters:
System performance counters
Application performance counters
Performance Monitoring (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 9/30Slide 9 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
The following table lists some of the system performance
counters.
Performance Monitoring (Contd.)
System Performance Counter Descript ion
Application Running Represents the number of applications running
simultaneously on a Web server.
Requests Disconnected Represents the number of requests that have been
disconnected due to a communication failure.
Request Wait Time Represents the number of milliseconds that the most
recent request waited in the queue for being processed
by the server.
State Server Sessions Active Represents the number of user sessions that have
become inactive because of some user action. This
counter is available only on the computer where the
state server service, aspnet_state is running.
Worker Process Running Represents the number of worker processes running ona Web server.
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 10/30Slide 10 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
The following table lists some of the application
performance counters.
Performance Monitoring (Contd.)
Appl icat ion Performance Counter Descr ipt ion
Anonymous Requests Represents the number of requests that are using
anonymous authentication.
Anonymous Requests/Sec Represents the number of requests per second that
are using anonymous authentication.
Cache Total Entries Represents the total number of entries in the cache.
Cache Total Hits Represents the total number of hits from the cache.
Debugging Requests Represents the number of requests that occur while
debugging is enabled.
Let us see how to configure performance counters by using
system monitor
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 11/30Slide 11 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
Mobile devices have many limitations such as small display
area and low bandwidth.
Due to these limitations, a Web page created for desktop
browsers cannot be properly displayed on mobile devices.
You need to create specifically designed Web pages for mobile devices.
ASP.NET provides you with the System.Web.Mobile
namespace that is used specifically for mobile Web
development.
The System.Web.Mobile namespace contains the corecapabilities such as authentication and error handling,
required for building ASP.NET mobile Web applications.
Creating Mobile Web Pages
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 12/30Slide 12 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
The ASP.NET mobile Web controls are contained in theSystem.Web.UI.MobileControls namespace that
provides the user interface elements for rendering mobile
Web applications.
Some controls that are specific to the mobile Web pages
are:
Form control
Command control
PhoneCall control
List and ObjectList controlDeviceSpecific control
SelectionList control
StyleSheet control
TextView control
Working With Mobile Web Controls
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 13/30Slide 13 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
Form control:
A Form control is a container control that provides the
capability to group controls together.
Each Form control can hold a group of logically related
controls.
The Form controls can be displayed by setting theActiveForm property of the Web page.
Command control:
A Command control combines the functionality of the normal
Button, ImageButton, and LinkButton controls.
The Command control has properties similar to that of the
Button server control.
The Command control can be added to a mobile page by usingthe <Command> element.
Working With Mobile Web Controls (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 14/30Slide 14 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
PhoneCall control:
A PhoneCall control is used to enable applications to initiate
telephone calls if the user's mobile device supports the
capability of placing phone calls:
If the mobile supports the capability, the phone number specified
by using PhoneNumber property of the PhoneCall control isdisplayed as hyperlink.
If the mobile device does not support the capability, the
PhoneCall control displays the phone number as text.
The PhoneCall control can be added to a mobile page by usingthe <PhoneCall> element. To use a PhoneCall control, you
need to: Add the control onto a Form or Panel control or inside a control's
template on an ASP.NET mobile Web page.
Specify the Text and the PhoneNumber properties.
Working With Mobile Web Controls (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 15/30Slide 15 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
List and ObjectList controls:
The List control includes the functionality that is provided by
the DataList and Repeater controls.
The List control can be added to a mobile page by using the<List> element.
The ObjectList control includes the functionality that is
provided by the DataGrid control.
The ObjectList control can be added to a mobile page by usingthe <ObjectList> element.
Working With Mobile Web Controls (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 16/30Slide 16 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
DeviceSpecific control:
The DeviceSpecific control is used to specify a choice among
multiple content alternatives.
The DeviceSpecific control is used to specify template sets
and override properties.
SelectionList control:
The SelectionList control provides different visual
representations for a list of selectable items.
The SelectionList control combines the functionality of the
CheckBox, CheckBoxList, DropDownList, ListBox,
RadioButton, and the RadioButton Web server controls.You can use the SelectType property of the SelectionList
control to define the type of selection list button to render.
Working With Mobile Web Controls (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 17/30Slide 17 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
TextView control:
The TextView control is to display large quantities of text.
The TextView control supports device filters for overriding
property values.
The TextView control can be added to a mobile page by usingthe <TextView> element.
Working With Mobile Web Controls (Contd.)
Let us see how to create a Web form for mobile devices
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 18/30Slide 18 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
Device emulators:
Are software programs that simulate the environment of a cell
phone or PDA on the desktop of your PC.
Are treated as virtual mobile devices.
Are available, for most mobile devices, to simulate the
behavior of the hardware and browsers of the mobiles.
Allow you to view mobile Web forms as they would appear on
the actual mobile devices.
Enable you to test your mobile Web applications before
deploying.
Working with Device Emulators
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 19/30Slide 19 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
There are various mobile devices available in the market
that have different capabilities and differ from each other in
terms of:
Screen size
Color combination
Browser type
Many other features
Due to these differences, a Web control is rendered
differently on different mobile devices.
Therefore, if you want to create a Web application that canrun on multiple mobile devices, you need to create a
separate user interface for each device, which is a tedious
and complex task.
This task can be simplified by using control adapters and
device filters provided by ASP.NET.
Rendering Content on Mobile Web Pages
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 20/30Slide 20 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
Mobile devices have different screen sizes and capabilities.
The controls are rendered on the Web page on the basis of
the capabilities of a browser that requested for the page.
This type of browser-based rendering of controls is known
as adaptive rendering and can be implemented by usingcontrol adapters.
A control adapter is used for device-specific rendering of
mobile Web controls instead of using the control's default
rendering logic.
Implementing Control Adapters
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 21/30Slide 21 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
To customize the behavior of Web controls, you need tospecify an object of the ControlAdapter class.
The ControlAdapter class:
Is an abstract class that defines the basic functionality for all
adapters.
Overrides certain methods and events of the Control class
to allow browser or markup-specific handling.
Implementing Control Adapters (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 22/30Slide 22 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
Different mobile devices have different capabilities.
Therefore, you should design a Web page that caters to all
the possible types of mobile devices.
The ability to render a control based on the type of the
device is known as device-specific rendering.This requires you to set the properties of the controls based
on the capabilities of the mobile devices by using device
filters.
ASP.NET allows you to specify device filters for each type of
device by using the <DeviceSpecific><Choice> tags.You can insert the <DeviceSpecific> tag as a child
element of any mobile control on the Web page.
Implementing Device-Specific Rendering
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 23/30
Slide 23 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
The <Choice> tag represents device characteristic/value
pairs, where the device characteristic is drawn from a
number of sources.
A control can contain only one <DeviceSpecific> tag,
but many <Choice> tags.
Choices are evaluated in the order in which they appear in
the DeviceSpecific/Choice construct.
Each <Choice> tag contains:
A Filter attribute that specifies the devices that this choice
applies to. Additional property values that override the properties of the
original control when the device specified by the Filter attribute
is used.
Implementing Device-Specific Rendering (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 24/30
Slide 24 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
When the name of a method is used as a filter, the choice is
applied on the basis of the Boolean value returned by the
method.
The filter method must conform to the following signature:
public bool methodName(System.Web.Mobile.MobileCapabilities capabilities,
string optionalArgument);
Implementing Device-Specific Rendering (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 25/30
Slide 25 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
The Filter attribute can also specify the name of a filter
defined in the web.config file. These filters can be of two
types:
Comparison filter
Evaluator delegate filter
Implementing Device-Specific Rendering (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 26/30
Slide 26 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
Problem Statement:
The management of MusicMania has decided to make its Web
application available on mobile devices. In the initial phase, you
are only required to create the MobileMusic.aspx page that
should be displayed as the home page when a user requests
for the MusicMania website. This page should contain twoforms, frmHome and frmAlbum.
When a mobile device requests for the home page, the
frmHome form should be displayed on the MobileMusic page.
This form should display the colored logo of the company.
There should also be a button, DisplayAlbumDetails, on the
frmHome form. When the user clicks this button, the frmAlbum
form should be displayed. The frmAlbum form should display
the details of the latest album.
Activity 15.1: Creating a Web Form for Mobile Devices
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 27/30
Slide 27 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
Solution:
To design the MobileMusic page, you need to perform the
following tasks:
1. Add a new Web Page.
2. Design the new Web page.
3. Execute the application by using device emulator.
Activity 15.1: Creating a Web Form for Mobile Devices (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 28/30
Slide 28 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
In this session, you learned that:
ASP.NET provides you with the following two features for
monitoring a Web application:
Health monitoring
Performance monitoring
ASP.NET supports the following two groups of performancecounters:
System performance counters
Application performance counters
A Web page created for desktop browsers cannot be properly
displayed on mobile devices because mobile devices havesmall display area and low bandwidth.
ASP.NET provides you with the System.Web.Mobile
namespace that is used specifically for mobile Web
development.
Summary
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 29/30
Slide 29 of 30Ver. 1.0
Developing Web Applications Using ASP.NET
Mobile Web pages have some specific controls. These are:
Form
Command
PhoneCall
List and ObjectList
DeviceSpecificSelectionList
StyleSheet
TextView
Device emulators are software programs that simulate the
environment of a cell phone or PDA on the desktop of your PC.
A control adapter is used for device-specific rendering of
mobile Web controls instead of using the control's default
rendering logic.
Summary (Contd.)
7/30/2019 ASP.net Session 20
http://slidepdf.com/reader/full/aspnet-session-20 30/30
Developing Web Applications Using ASP.NET
To customize the behavior of Web controls, you need tospecify an object of the ControlAdapter class.
The ControlAdapter class is an abstract class that defines
the basic functionality for all adapters.
The ability to render a control based on the type of the device
is known as device-specific rendering.
Summary (Contd.)