SlideShare a Scribd company logo
Developing Web Applications Using ASP.NET
In this session, you will learn to:
Explain how to detect mobile devices and redirect them to an
appropriate page in a Web application
Describe mobile Web pages, forms, and mobile controls
Explain how to use device-specific features in mobile Web
pages to respond to the different capabilities of mobile devices
Explain how to use device emulators in Microsoft Visual Studio
2005 to test mobile Web pages
Design and implement mobile Web forms
Design device-specific features for mobile Web pages
Objectives
Developing Web Applications Using ASP.NET
Device emulators run on a computer but behave as Pocket
PCs, mobile phones, or other piece of hardware.
Developer can use device emulators to test applications on
a range of different devices without having to obtain, install,
or configure all of them.
Visual Studio integrates the device emulators into the
development environment to help streamline the production
and testing of mobile applications.
Microsoft Device Emulator 1.0 included in Visual Studio
2005 can emulate devices running:
Microsoft Windows CE 5.0
Microsoft Pocket PC 2003
Microsoft Smartphone 2003
Device Emulators for Mobile Web Forms
Developing Web Applications Using ASP.NET
You can start the device emulators using the Device
Emulator Manager.
Device Emulators for Mobile Web Forms (Contd.)
Developing Web Applications Using ASP.NET
You can simulate placing a device in its cradle and
saving the state of the device.
You can simulate a device with a storage card by using a
shared folder on your hard drive, and specifying the
amount of memory available to the device.
Microsoft Device Emulator can browse a Visual Studio
Web project by using:
Physical network card installed on the computer
Microsoft Loopback Adapter
Microsoft ActiveSync 4.1
Device Emulators for Mobile Web Forms (Contd.)
Developing Web Applications Using ASP.NET
Other Device Emulators:
Manufacturers of mobile devices also provide emulators of
their hardware.
An appropriate emulator needs to be installed in case the
application is targeted to a specific device.
Device Emulators for Mobile Web Forms (Contd.)
Developing Web Applications Using ASP.NET
In Visual Studio 2005, you can:
Activate a device emulator by using the Connect To Device
command on the Tools menu.
Control device emulators by using Device Emulator Manager
command on the Tools menu.
Configure device emulators by clicking the Options command
on the Tools menu and then clicking Device Tools.
Device Emulators for Mobile Web Forms (Contd.)
Connect to Device Command
Device Emulator Manager
Options Command
Developing Web Applications Using ASP.NET
Web applications designed to run on mobile devices as well
as desktop computers typically:
Detect the type of device requesting the Web page.
Redirect the request to pages specifically designed for mobile
devices, if necessary.
Mobile Device Detection and Redirection
Developing Web Applications Using ASP.NET
Using the Browser Object to Detect a Mobile Device:
The Request.Browser property returns an
HttpBrowserCapabilities object that contains information
about the browser that initiated the request.
The HttpBrowserCapabilities object includes the
IsMobileDevice property to detect mobile-device requests.
A Web request from a mobile device can be redirected to
another Web page:
protected void Page_Load(object sender, EventArgs e)
{
if(Request.Browser.IsMobileDevice)
Response.Redirect("MobileForms/default.aspx");
}
Mobile Device Detection and Redirection (Contd.)
Developing Web Applications Using ASP.NET
Many mobile devices do not support cookies. Therefore, you
should avoid using cookies in mobile applications.
Some mobile devices do not accept relative URLs.
To handle such devices, an <httpRuntime> tag can be
inserted in the Web.config file:
<system.web>
<httpRuntime useFullyQualifiedRedirectUrl="true" />
</system.web>
Mobile Device Detection and Redirection (Contd.)
Developing Web Applications Using ASP.NET
ASP .NET enables you to create Web pages targeted
specifically to mobile devices. These Web pages are called
mobile Web pages.
Mobile Web pages respond to the constraints of small
screens and adapt to various capabilities easily.
Mobile Web pages are designed by using Mobile server
controls.
ASP.NET Mobile Designer can be used to design and build
mobile Web pages.
ASP.NET Mobile Designer is similar to the Web Designer,
with Design and Source views to create the layout and code
window to write the code.
Mobile controls cannot be resized in the Mobile Designer.
Design view of a mobile page is not a WYSIWYG editor.
Mobile Web Forms
Developing Web Applications Using ASP.NET
Mobile Web pages are instances of the
System.Web.UI.MobileControls.MobilePage class.
A mobile Web page must contain at least one
<mobile:Form> tag.
A single Web form is broken into several forms for a mobile
device.
Switching from one form to another is done
programmatically.
Each form on the page shares the same code-behind file.
Each control is usually placed on a new line. However, by
setting the BreakAfter property, controls can be arranged
in the same line.
Mobile Web Forms (Contd.)
Developing Web Applications Using ASP.NET
Mobile server controls are members of the
System.Web.UI.MobileControls namespace.
Mobile server controls are designed and optimized for use
on mobile device.
Many mobile server controls are directly analogous to
existing Web server controls.
Some controls that are unique to the
System.Web.UI.MobileControls namespace are:
PhoneCall
ControlPager
DeviceSpecific
Mobile Web Forms (Contd.)
Developing Web Applications Using ASP.NET
Mobile server controls are present in the Mobile Web Forms
group in the Toolbox.
Mobile Web Forms (Contd.)
Mobile Server Controls
Developing Web Applications Using ASP.NET
Depending on the capabilities of the viewing device,
different content may need to be rendered on a mobile
page.
You can use the <DeviceSpecfic> tag to enable you to
perform conditional rendering.
The <DeviceSpecific> tag enables you to write markup
that is specific to a device.
Within the <DeviceSpecific> tag, you can add child
<Choice> tags.
Device-Specific Features in Mobile Web Forms
Developing Web Applications Using ASP.NET
The <Choice> tag includes:
A filter attribute to specify the device that the choice applies
to.
One or more property values, which will override the
corresponding tag on the original control if this choice is used.
<mobile:Image runat=server>
<DeviceSpecific>
<Choice Filter=“TestIsColor"
ImageURL="colorTree.gif"/>
<Choice Filter=“TestIsWML11"
ImageURL="tree.wbmp"/>
<Choice ImageURL="monoTree.gif"/>
</DeviceSpecific>
</mobile:Image>
Device-Specific Features in Mobile Web Forms (Contd.)
Developing Web Applications Using ASP.NET
The Filter attribute in each <Choice> tag can have two
types of values:
The name of a method on the page.
The name of a device filter in the Web.config file.
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);
Device-Specific Features in Mobile Web Forms (Contd.)
Developing Web Applications Using ASP.NET
When a device filter in Web.Config is used as a filter:
The filter can be of two types:
Comparison filter
Evaluator delegate filter
The following code represents the use of the two types of
filters:
<system.web>
<deviceFilters>
<filter name="TestIsColor" compare="IsColor"
argument="true" />
<filter name="TestColorDepth"
type="clsDeviceTests" method="testDepth" />
</deviceFilters>
</system.web>
Device-Specific Features in Mobile Web Forms (Contd.)
Developing Web Applications Using ASP.NET
Problem Statement:
You are a developer in the Adventure Works organization, a
fictitious bicycle manufacturer. You have been asked to assist
in the development of the Business-to-Consumer (B2C) Web
application and a related Business-to-Employee (B2E) extranet
portal.
Decisions on the design of the application have already been
taken. You have been asked to carry out a number of specific
tasks in order to implement various elements of this design.
Demo: Making Web Applications Available to Mobile
Developing Web Applications Using ASP.NET
As part of the first phase of the B2C development, you have
been asked to create a new page, MobileDefault.aspx,
specifically designed for PDAs, mobile phones, and other
mobile devices. Mobile devices will be automatically forwarded
to this page, and the page will respond to the specific
capabilities of the device that makes a request.
Demo: Making Web Applications Available to Mobile (Contd.)
Developing Web Applications Using ASP.NET
Solution:
You need to perform following tasks:
1. Manage Redirection for Mobile Devices
a. Open the Adventure Works Web site for editing in Visual Studio.
b. Detect mobile devices on the Adventure Works home page.
c. Handle devices that cannot use relative URLs.
d. Add a new mobile page to the application.
e. Configure the Pocket PC emulator and browse the Web application.
2. Design and Implement a Mobile Web Form
a. Add controls to the default form of the MobileDefault.aspx page.
b. Add a second form to the MobileDefault.aspx page.
Demo: Making Web Applications Available to Mobile (Contd.)
Developing Web Applications Using ASP.NET
3. Design Device-Specific Features for a Mobile Web Application
a. Add a new method for evaluating the color depth of a browser.
b. Insert device-specific features into MobileDefault.aspx.
c. Check the capabilities of the browser in your code.
4. Browse a Mobile Web Application with Specific Device Emulators
a. Browse the project with the Pocket PC emulator.
b. Browse the project by using the Smartphone emulator.
c. Browse the project by using Internet Explorer.
Demo: Making Web Applications Available to Mobile (Contd.)
Developing Web Applications Using ASP.NET
In this session, you learned that:
Visual Studio 2005 includes the Microsoft Device Emulator 1.0.
which can emulate devices running Microsoft Windows CE 5.0,
Microsoft Pocket PC 2003, and Microsoft Smartphone 2003.
Many manufacturers of mobile devices also provide emulators
of their hardware to assist in developing mobile applications.
Visual Studio provides options in Tools menu to activate,
control, and configure device emulators.
The Request.Browser property returns an
HttpBrowserCapabilities object that contains information
about the browser that initiated the request.
The ASP.NET Mobile Designer is used to design and build
mobile Web pages.
Summary
Developing Web Applications Using ASP.NET
In mobile Web pages, a single Web form is broken up into
several forms to cope with the small screen size of a mobile
device.
Mobile server controls are designed to adapt intelligently to the
capabilities of the requesting browser.
<DeviceSpecfic> tag is used in a mobile page to write
markup that is specific to a device.
Summary (Contd.)

More Related Content

PPS
10 asp.net session14
PPTX
Mobile application
ODP
Developing Exceptional Mobile Application
PPTX
Jquery mobile book review
PDF
01 08 - graphical user interface - layouts
PDF
Android Screen Containers & Layouts
PDF
01 09 - graphical user interface - basic widgets
PPT
android layouts
10 asp.net session14
Mobile application
Developing Exceptional Mobile Application
Jquery mobile book review
01 08 - graphical user interface - layouts
Android Screen Containers & Layouts
01 09 - graphical user interface - basic widgets
android layouts

What's hot (20)

PPTX
PDF
Android layouts
PPTX
Android User Interface
PDF
Getting started with ibm worklight tips
PPTX
Android development session 3 - layout
PDF
Android ui layout
PPT
View groups containers
PDF
Integrating into Visual Studio settings
PDF
IBM MobileFirst Platform 7.0 POT InApp Feedback V0.1
PDF
04 user interfaces
PDF
AndroidManifest
PDF
IBM MobileFirst Platform Pot Sentiment Analysis v3
PPTX
Android Widget
PPT
Multiple Activity and Navigation Primer
PDF
IBM MobileFirst Platform v7.0 POT App Mgmt Lab v1.1
PDF
Chapter 10 - Views Part 2
PPTX
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & Menus
PDF
IBM MobileFirst Platform v7.0 POT Offers Lab v1.0
PDF
Rc085 010d-vaadin7
PPT
Integrate Shindig with Joomla
Android layouts
Android User Interface
Getting started with ibm worklight tips
Android development session 3 - layout
Android ui layout
View groups containers
Integrating into Visual Studio settings
IBM MobileFirst Platform 7.0 POT InApp Feedback V0.1
04 user interfaces
AndroidManifest
IBM MobileFirst Platform Pot Sentiment Analysis v3
Android Widget
Multiple Activity and Navigation Primer
IBM MobileFirst Platform v7.0 POT App Mgmt Lab v1.1
Chapter 10 - Views Part 2
Learn Xamarin Absolute Beginners - Permissions, Building the App GUI & Menus
IBM MobileFirst Platform v7.0 POT Offers Lab v1.0
Rc085 010d-vaadin7
Integrate Shindig with Joomla
Ad

Similar to 10 asp.net session14 (20)

PPTX
Nonintrusive semantic html5
PPTX
SmartPhone Design and Delivery
PDF
How to create a mobile version of your website
PPTX
01 01 - introduction to mobile application development
PPTX
Mobile application development PowerPoin
 
PPTX
Design of mobile browsers
PDF
Siruna session at Drupalcon Paris 2009
PPTX
chapter2
PPT
Drupalcamp LA Aug 2009
PDF
Mobile Website Optimization
PPT
QuickSoft Mobile Tips & Tricks 11-03-10
PPT
Mobile Devolpment Slides
PPTX
How To Be an HTML5 Mobile Cloud Champion
PDF
Drupalcamp New York 2009
PPTX
Kentico Technical Learning - Responsive Design with Kentico CMS 7
PPTX
Best Practices for Mobile Web Design
PDF
Going mobile - tip, tricks and tools for building mobile web-apps
PPTX
SharePoint and Mobile
PDF
Resource discovery on mobile devices keren mills
PPTX
Mobile Application Development Handout by Tariku
Nonintrusive semantic html5
SmartPhone Design and Delivery
How to create a mobile version of your website
01 01 - introduction to mobile application development
Mobile application development PowerPoin
 
Design of mobile browsers
Siruna session at Drupalcon Paris 2009
chapter2
Drupalcamp LA Aug 2009
Mobile Website Optimization
QuickSoft Mobile Tips & Tricks 11-03-10
Mobile Devolpment Slides
How To Be an HTML5 Mobile Cloud Champion
Drupalcamp New York 2009
Kentico Technical Learning - Responsive Design with Kentico CMS 7
Best Practices for Mobile Web Design
Going mobile - tip, tricks and tools for building mobile web-apps
SharePoint and Mobile
Resource discovery on mobile devices keren mills
Mobile Application Development Handout by Tariku
Ad

More from Vivek Singh Chandel (20)

PDF
Deceptive Marketing.pdf
PDF
brain controled wheel chair.pdf
PDF
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
PDF
Manav dharma shashtra tatha shashan paddati munshiram jigyasu
PDF
Self driving and connected cars fooling sensors and tracking drivers
PDF
EEG Acquisition Device to Control Wheelchair Using Thoughts
PDF
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
PPSX
Net framework session01
PPSX
Net framework session03
PPSX
Net framework session02
PPSX
04 intel v_tune_session_05
PPSX
03 intel v_tune_session_04
PPSX
02 intel v_tune_session_02
PPSX
01 intel v_tune_session_01
PPSX
09 intel v_tune_session_13
PPSX
07 intel v_tune_session_10
PPSX
02 asp.net session02
PPSX
01 asp.net session01
PPSX
16 asp.net session23
PPSX
15 asp.net session22
Deceptive Marketing.pdf
brain controled wheel chair.pdf
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Manav dharma shashtra tatha shashan paddati munshiram jigyasu
Self driving and connected cars fooling sensors and tracking drivers
EEG Acquisition Device to Control Wheelchair Using Thoughts
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Net framework session01
Net framework session03
Net framework session02
04 intel v_tune_session_05
03 intel v_tune_session_04
02 intel v_tune_session_02
01 intel v_tune_session_01
09 intel v_tune_session_13
07 intel v_tune_session_10
02 asp.net session02
01 asp.net session01
16 asp.net session23
15 asp.net session22

Recently uploaded (20)

PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Presentation on HIE in infants and its manifestations
PDF
RMMM.pdf make it easy to upload and study
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Institutional Correction lecture only . . .
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Computing-Curriculum for Schools in Ghana
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Cell Types and Its function , kingdom of life
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Final Presentation General Medicine 03-08-2024.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Microbial disease of the cardiovascular and lymphatic systems
Presentation on HIE in infants and its manifestations
RMMM.pdf make it easy to upload and study
STATICS OF THE RIGID BODIES Hibbelers.pdf
Complications of Minimal Access Surgery at WLH
O5-L3 Freight Transport Ops (International) V1.pdf
Institutional Correction lecture only . . .
Abdominal Access Techniques with Prof. Dr. R K Mishra
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Chinmaya Tiranga quiz Grand Finale.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Module 4: Burden of Disease Tutorial Slides S2 2025
Computing-Curriculum for Schools in Ghana
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Cell Types and Its function , kingdom of life

10 asp.net session14

  • 1. Developing Web Applications Using ASP.NET In this session, you will learn to: Explain how to detect mobile devices and redirect them to an appropriate page in a Web application Describe mobile Web pages, forms, and mobile controls Explain how to use device-specific features in mobile Web pages to respond to the different capabilities of mobile devices Explain how to use device emulators in Microsoft Visual Studio 2005 to test mobile Web pages Design and implement mobile Web forms Design device-specific features for mobile Web pages Objectives
  • 2. Developing Web Applications Using ASP.NET Device emulators run on a computer but behave as Pocket PCs, mobile phones, or other piece of hardware. Developer can use device emulators to test applications on a range of different devices without having to obtain, install, or configure all of them. Visual Studio integrates the device emulators into the development environment to help streamline the production and testing of mobile applications. Microsoft Device Emulator 1.0 included in Visual Studio 2005 can emulate devices running: Microsoft Windows CE 5.0 Microsoft Pocket PC 2003 Microsoft Smartphone 2003 Device Emulators for Mobile Web Forms
  • 3. Developing Web Applications Using ASP.NET You can start the device emulators using the Device Emulator Manager. Device Emulators for Mobile Web Forms (Contd.)
  • 4. Developing Web Applications Using ASP.NET You can simulate placing a device in its cradle and saving the state of the device. You can simulate a device with a storage card by using a shared folder on your hard drive, and specifying the amount of memory available to the device. Microsoft Device Emulator can browse a Visual Studio Web project by using: Physical network card installed on the computer Microsoft Loopback Adapter Microsoft ActiveSync 4.1 Device Emulators for Mobile Web Forms (Contd.)
  • 5. Developing Web Applications Using ASP.NET Other Device Emulators: Manufacturers of mobile devices also provide emulators of their hardware. An appropriate emulator needs to be installed in case the application is targeted to a specific device. Device Emulators for Mobile Web Forms (Contd.)
  • 6. Developing Web Applications Using ASP.NET In Visual Studio 2005, you can: Activate a device emulator by using the Connect To Device command on the Tools menu. Control device emulators by using Device Emulator Manager command on the Tools menu. Configure device emulators by clicking the Options command on the Tools menu and then clicking Device Tools. Device Emulators for Mobile Web Forms (Contd.) Connect to Device Command Device Emulator Manager Options Command
  • 7. Developing Web Applications Using ASP.NET Web applications designed to run on mobile devices as well as desktop computers typically: Detect the type of device requesting the Web page. Redirect the request to pages specifically designed for mobile devices, if necessary. Mobile Device Detection and Redirection
  • 8. Developing Web Applications Using ASP.NET Using the Browser Object to Detect a Mobile Device: The Request.Browser property returns an HttpBrowserCapabilities object that contains information about the browser that initiated the request. The HttpBrowserCapabilities object includes the IsMobileDevice property to detect mobile-device requests. A Web request from a mobile device can be redirected to another Web page: protected void Page_Load(object sender, EventArgs e) { if(Request.Browser.IsMobileDevice) Response.Redirect("MobileForms/default.aspx"); } Mobile Device Detection and Redirection (Contd.)
  • 9. Developing Web Applications Using ASP.NET Many mobile devices do not support cookies. Therefore, you should avoid using cookies in mobile applications. Some mobile devices do not accept relative URLs. To handle such devices, an <httpRuntime> tag can be inserted in the Web.config file: <system.web> <httpRuntime useFullyQualifiedRedirectUrl="true" /> </system.web> Mobile Device Detection and Redirection (Contd.)
  • 10. Developing Web Applications Using ASP.NET ASP .NET enables you to create Web pages targeted specifically to mobile devices. These Web pages are called mobile Web pages. Mobile Web pages respond to the constraints of small screens and adapt to various capabilities easily. Mobile Web pages are designed by using Mobile server controls. ASP.NET Mobile Designer can be used to design and build mobile Web pages. ASP.NET Mobile Designer is similar to the Web Designer, with Design and Source views to create the layout and code window to write the code. Mobile controls cannot be resized in the Mobile Designer. Design view of a mobile page is not a WYSIWYG editor. Mobile Web Forms
  • 11. Developing Web Applications Using ASP.NET Mobile Web pages are instances of the System.Web.UI.MobileControls.MobilePage class. A mobile Web page must contain at least one <mobile:Form> tag. A single Web form is broken into several forms for a mobile device. Switching from one form to another is done programmatically. Each form on the page shares the same code-behind file. Each control is usually placed on a new line. However, by setting the BreakAfter property, controls can be arranged in the same line. Mobile Web Forms (Contd.)
  • 12. Developing Web Applications Using ASP.NET Mobile server controls are members of the System.Web.UI.MobileControls namespace. Mobile server controls are designed and optimized for use on mobile device. Many mobile server controls are directly analogous to existing Web server controls. Some controls that are unique to the System.Web.UI.MobileControls namespace are: PhoneCall ControlPager DeviceSpecific Mobile Web Forms (Contd.)
  • 13. Developing Web Applications Using ASP.NET Mobile server controls are present in the Mobile Web Forms group in the Toolbox. Mobile Web Forms (Contd.) Mobile Server Controls
  • 14. Developing Web Applications Using ASP.NET Depending on the capabilities of the viewing device, different content may need to be rendered on a mobile page. You can use the <DeviceSpecfic> tag to enable you to perform conditional rendering. The <DeviceSpecific> tag enables you to write markup that is specific to a device. Within the <DeviceSpecific> tag, you can add child <Choice> tags. Device-Specific Features in Mobile Web Forms
  • 15. Developing Web Applications Using ASP.NET The <Choice> tag includes: A filter attribute to specify the device that the choice applies to. One or more property values, which will override the corresponding tag on the original control if this choice is used. <mobile:Image runat=server> <DeviceSpecific> <Choice Filter=“TestIsColor" ImageURL="colorTree.gif"/> <Choice Filter=“TestIsWML11" ImageURL="tree.wbmp"/> <Choice ImageURL="monoTree.gif"/> </DeviceSpecific> </mobile:Image> Device-Specific Features in Mobile Web Forms (Contd.)
  • 16. Developing Web Applications Using ASP.NET The Filter attribute in each <Choice> tag can have two types of values: The name of a method on the page. The name of a device filter in the Web.config file. 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); Device-Specific Features in Mobile Web Forms (Contd.)
  • 17. Developing Web Applications Using ASP.NET When a device filter in Web.Config is used as a filter: The filter can be of two types: Comparison filter Evaluator delegate filter The following code represents the use of the two types of filters: <system.web> <deviceFilters> <filter name="TestIsColor" compare="IsColor" argument="true" /> <filter name="TestColorDepth" type="clsDeviceTests" method="testDepth" /> </deviceFilters> </system.web> Device-Specific Features in Mobile Web Forms (Contd.)
  • 18. Developing Web Applications Using ASP.NET Problem Statement: You are a developer in the Adventure Works organization, a fictitious bicycle manufacturer. You have been asked to assist in the development of the Business-to-Consumer (B2C) Web application and a related Business-to-Employee (B2E) extranet portal. Decisions on the design of the application have already been taken. You have been asked to carry out a number of specific tasks in order to implement various elements of this design. Demo: Making Web Applications Available to Mobile
  • 19. Developing Web Applications Using ASP.NET As part of the first phase of the B2C development, you have been asked to create a new page, MobileDefault.aspx, specifically designed for PDAs, mobile phones, and other mobile devices. Mobile devices will be automatically forwarded to this page, and the page will respond to the specific capabilities of the device that makes a request. Demo: Making Web Applications Available to Mobile (Contd.)
  • 20. Developing Web Applications Using ASP.NET Solution: You need to perform following tasks: 1. Manage Redirection for Mobile Devices a. Open the Adventure Works Web site for editing in Visual Studio. b. Detect mobile devices on the Adventure Works home page. c. Handle devices that cannot use relative URLs. d. Add a new mobile page to the application. e. Configure the Pocket PC emulator and browse the Web application. 2. Design and Implement a Mobile Web Form a. Add controls to the default form of the MobileDefault.aspx page. b. Add a second form to the MobileDefault.aspx page. Demo: Making Web Applications Available to Mobile (Contd.)
  • 21. Developing Web Applications Using ASP.NET 3. Design Device-Specific Features for a Mobile Web Application a. Add a new method for evaluating the color depth of a browser. b. Insert device-specific features into MobileDefault.aspx. c. Check the capabilities of the browser in your code. 4. Browse a Mobile Web Application with Specific Device Emulators a. Browse the project with the Pocket PC emulator. b. Browse the project by using the Smartphone emulator. c. Browse the project by using Internet Explorer. Demo: Making Web Applications Available to Mobile (Contd.)
  • 22. Developing Web Applications Using ASP.NET In this session, you learned that: Visual Studio 2005 includes the Microsoft Device Emulator 1.0. which can emulate devices running Microsoft Windows CE 5.0, Microsoft Pocket PC 2003, and Microsoft Smartphone 2003. Many manufacturers of mobile devices also provide emulators of their hardware to assist in developing mobile applications. Visual Studio provides options in Tools menu to activate, control, and configure device emulators. The Request.Browser property returns an HttpBrowserCapabilities object that contains information about the browser that initiated the request. The ASP.NET Mobile Designer is used to design and build mobile Web pages. Summary
  • 23. Developing Web Applications Using ASP.NET In mobile Web pages, a single Web form is broken up into several forms to cope with the small screen size of a mobile device. Mobile server controls are designed to adapt intelligently to the capabilities of the requesting browser. <DeviceSpecfic> tag is used in a mobile page to write markup that is specific to a device. Summary (Contd.)