Building Microsoft ASP.NET Applications for Mobile Devices, Second Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Building Microsoft ASP.NET Applications for Mobile Devices, Second Edition [Electronic resources] - نسخه متنی

Andy Wigley; Peter Roxburgh

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید






Chapter 2, you learned how to test your applications using Internet Explorer and the Openwave simulator. The use of the WML, cHTML, or XHTML browser of your choice alongside Internet Explorer might prove sufficient for much of your initial application testing. However, if you expect your users to access your application from different devices, you should test with emulators of those devices and, ultimately, with the actual devices. Although the software emulator tools often use the same browser software used in the actual device, there's no substitute for testing with the real device. Emulators operate as Windows processes, which clearly isn't the situation when the browser runs on a mobile phone or handheld device. The other major difference between an emulator and a real device is in the response speeds. A real device operating over a wireless network uses network links that operate much slower than an emulator operating over your local area network (LAN). Real wireless network links also experience much higher latency—the delay introduced by network components. You must test with real devices to get a realistic feel for the performance of your application.


Using Pocket Internet Explorer for Application Testing


The Pocket PC is a very popular and versatile handheld device. Pocket Internet Explorer, an HTML 3.2 browser that runs on devices with the Pocket PC 2000 and Pocket PC 2002 operating systems, is one of the browsers that ASP.NET mobile controls support. From a developer's point of view, Pocket Internet Explorer is one of the more interesting clients because it supports a large screen and color display, allowing more flexibility in content design.

Pocket PC Phone Edition devices include integrated telephony support, enabling you to connect to the Internet by signing up with a wireless Internet service provider (ISP). Other devices are equipped with 802.11 support, allowing them to connect to a wireless LAN (WLAN) or to a WLAN hot spot in public spaces such as airports, coffee shops, and meeting halls. Devices without integrated wireless network connectivity can still connect to the Web through a fixed line when equipped with an appropriate modem. Alternatively, if you have a mobile phone that's Internet enabled and supports infrared communications, you can use the infrared (IR) link of the Pocket PC to connect to the mobile phone and thus connect to the Web.

As a developer, you'll do much better to connect to your development Web server over the LAN, without connecting over external wireless or fixed-line networks. Connecting to your development Web server over a secure and private LAN will promote rapid and cost-efficient coding without requiring you to debug in a live environment.

When you place your Pocket PC in its desktop cradle and connect it to your PC using a serial or USB connection, you can use Microsoft ActiveSync software to connect the two components and thus synchronize your contacts, e-mail, data, and cached Web content. In versions of Pocket PC software prior to Pocket PC 2002, Pocket Internet Explorer was unable to connect to the Web over an ActiveSync connection, although that restriction is now removed.

As an alternative to accessing the Web over an ActiveSync connection, you can equip your Pocket PC with an Ethernet card, such as those from Socket Communications (http://www.socketcom.com). This card is essential for power users such as mobile application developers. An Ethernet card connects your Pocket PC to your LAN and enables you to use Pocket Internet Explorer to connect to applications on any Web server—including development servers on your LAN.

The Microsoft Pocket PC Web site offers a tool that allows you to remotely control your Pocket PC from your desktop. This tool is called Remote Display Control, and it's invaluable when testing with a real device. You can download this tool from http://www.microsoft.com/mobile/pocketpc/downloads/powertoys.asp. This unsupported tool opens a window on your desktop PC that's a copy of the current display on the remote Pocket PC connected to your network. You can also enter data using your PC keyboard as though you were inputting it directly into the Pocket PC, which can save you time during development testing.


Using a Pocket PC Emulator


If you don't have access to a real Pocket PC, a solution for testing with a Pocket PC is to use the Pocket PC 2002 emulator included in Microsoft Visual Studio .NET 2003. (Visual Studio .NET 2003 also includes an emulator of a Microsoft Windows CE .NET device.) This emulator is intended for developing applications for smart devices using the Microsoft .NET Compact Framework, but it's also invaluable for testing mobile Web applications. The Microsoft .NET Compact Framework is a "lite" version of the full .NET Framework, which supports the execution of .NET applications running on Pocket PC or Windows CE .NET devices. .NET Compact Framework applications are "rich-client" applications that run on the device, as compared with ASP.NET Mobile Controls applications that run on Web servers and communicate with Web browsers on the devices. The Pocket PC 2002 emulator runs the Windows CE operating system and includes all the standard bundled applications, including Pocket Internet Explorer.





Note

If you don't have Visual Studio .NET 2003, you can still get the Pocket PC emulators if you install eMbedded Visual Tools 3.0 (or later) on your PC. You can access this free download from http://www.microsoft.com/mobile/developer/default.asp or order it on CD. eMbedded Visual Tools 3.0 includes eMbedded Microsoft Visual Basic and eMbedded Microsoft Visual C++, both of which you can use to develop native applications for the Pocket PC. More important for the ASP.NET developer, eMbedded Visual Tools 3.0 also includes a full software emulation of a Pocket PC 2000 device. (You can download the Pocket PC 2002 SDK from the same source to "upgrade" the standard eMbedded Visual Tools emulator to the Pocket PC 2002 emulator, similar to the one bundled with Visual Studio .NET 2003.)

To run the emulator, go to Start, point to Microsoft Windows Platform SDK For Pocket PC, and then click Desktop Pocket PC Emulation.






Warning

The Pocket PC 2000 emulator that's shipped in eMbedded Visual Tools 3.0 doesn't include Microsoft JScript support by default, which is required for some ASP.NET mobile controls applications. You must download emulation support from the MSDN download center. See http://support.microsoft.com/support/kb/articles/Q296/9/04.ASP for details.


To start the emulator in Visual Studio .NET 2003, click the Tools menu, choose Connect To Device, select Pocket PC in the Platform drop-down list, select Pocket PC 2002 Emulator in the Devices list, and then click Connect.

If you haven't worked with a Pocket PC before, you'll notice that the Start button appears in the upper left corner of the screen instead of the lower left corner, as on a desktop PC. Click Start in the emulation, and click Internet Explorer in the menu that appears. To use Pocket Internet Explorer for development testing, you'll need to enter your own URLs. To do so, click View, and then click Address Bar to make the address bar visible, as shown in Figure 16-7. Make sure that the Fit To Screen option on this menu is checked.


Figure 16-7: Make the address bar visible in Pocket Internet Explorer to enter application URLs


Testing with a Microsoft Smartphone Emulator


The Smartphone Emulator for Windows CE is supported by Device Update 2 for ASP.NET, which you can download from the Microsoft ASP.NET Web site at http://www.asp.net/mobile/testeddevices.aspx?tabindex=6. (There are two versions of Device Update 2 available for download: one for Visual Studio .NET 2002 and one for Visual Studio .NET 2003.) The emulator is shown in Figure 16-8. This emulator is available for free, but you must first download and install Microsoft eMbedded Visual Tools (also free), which is the integrated development environment (IDE) you use to develop applications for Smartphone. Download eMbedded Visual Tools from http://www.microsoft.com/mobile /developer/default.asp, or order it on CD. When you install the eMbedded Visual Tools, you have the option of installing the Handheld PC SDK, Palm-Size PC SDK, and Pocket PC SDK, but you don't need these to use the Smartphone emulator.


Figure 16-8: The Microsoft Smartphone 2002 emulator, which uses Pocket Internet Explorer to enter application URLs

After you have installed eMbedded Visual Tools, you must download and install the Smartphone 2002 SDK, again from http://www.microsoft.com/mobile /developer/default.asp. When you have done so, you can start up the emulator. Start eMbedded Visual C++ 3.0 from the Start menu, click Tools, choose Configure Platform Manager, double-click Smartphone 2002 Emulation, and then click Test.

To use the Smartphone for testing mobile Web applications, click the left softkey, marked Programs, and then enter the number in the Programs list for Internet Explorer (number 4 by default). Click the right softkey, marked Menu, and then click the center of the main control pad to select the GoTo option. You can enter URLs on this page, as shown in Figure 16-8.


Testing with Mobile Phone Emulators


ASP.NET supports mobile Web applications on a large number of mobile devices, including the following:



Pocket Internet Explorer used on Pocket PC and Smartphone devices



11 different Nokia devices, plus the 3.0 (WML) and 3.1 (XHTML) emulators from the Nokia Mobile Internet Toolkit



Samsung and Sprint devices using Openwave UP.Browser



Sanyo and Sony devices, and the Openwave simulator with the Mitsubishi T250 skin that uses the Openwave UP.Browser version 3.2



Alcatel, Samsung, Sanyo, Sony, Siemens, LG, Motorola, and the UP.Browser 4.1 emulator with default skin that uses the Openwave UP.Browser version 4.1



Microsoft Mobile Explorer on Sony handsets



RIM BlackBerry 950 and 957 two-way pagers with the Go.America browser



Palm VIIx, Palm V, and m505 devices with Blazer, AvantGo, Go.America, Palm, AU-Systems, and Omnisky browsers



Mitsubishi and NEC 502i i-mode mobile phones



Ericsson T20, T29, T39, T65, T68, R320 and R380 devices, plus the R380 emulator and WAP Toolkit 3.2 emulator



Check the Microsoft ASP.NET Web site, at Chapter 19.

If you expect users to access your application with a number of different devices, you should plan to test with real examples of those devices. However, it's often more convenient—and less expensive—to test with emulators. Most of the major mobile phone suppliers and a number of other companies provide emulators that you can download for testing. The following is a list of some of the more popular emulators you can download:



NokiaNokia frequently updates its Nokia Mobile Internet Toolkit, which includes an emulator. Version 3.1 supports XHTML markup. You can also download emulators for many Nokia phones, including the 6210/6290 phone and a WML version 1.2 phone emulator, with more models added as they're released. You can download this toolkit for free from http://forum.nokia.com.



OpenwaveYou can download Openwave's simulator for free from http://developer.openwave.com, with version 3.2, 4.1.1, 5.0, 6.1, and 6.2 SDKs available at the time of writing. Version 6.1 and later includes a browser that supports XHTML markup, whereas version 4.1.1 includes an excellent WML 1.2 emulator. The emulator in the Openwave SDK version 4.1.1 and later has the advantage that it can be run from the command line, passing the URL to open as a command-line parameter. This allows integration of the emulator into Visual Studio .NET as a test tool, as described in the section "Integrating an Emulator into Visual Studio .NET," later in this chapter.



EricssonYou can download Ericsson's WapIDE 3.2.1, which includes phone emulators, from http://www.ericsson.com/mobilityworld/sub/open/tools-alll. This site offers additional R380 emulations, including one that supports Chinese character sets. Downloads are free to developers.



Go.AmericaThe Go.America browser includes an emulation of a RIM BlackBerry 950 or 957 device. After you register with Go.America's Web site, you can download this emulator for free from http: //www.goamerica.net/partners/developers/indexl.



Yospace Smartphone Emulator, Developer EditionThis is one of the best tools available for testing applications on a number of WML devices at once. Unfortunately it's not free, but you can download the evaluation edition to try it out before parting with any money! To download this emulator, go to http://www.yospace.com/spedel . This tool emulates the Nokia, Ericsson, and Openwave browsers and includes emulations of the Nokia 7110, 6210, 3330, 5210, 8310, and 7650 phones; Ericsson T68, T68i, R320, and R380 models; Motorola Timeport, V70 and V60; Siemens C35; and a Yospace concept personal digital assistant (PDA) called the Yopad. Best of all, you can enter a URL to fetch, and the emulator can test your mobile application on all these devices simultaneously.



WinWAPDesktop WML browser available from http://www.winwap.org. A fee is payable after the initial 30-day evaluation period. This desktop browser looks like an Internet Explorer window, but a menu option allows the screen to be configured to the same size as some popular mobile phones.



Check the manufacturers' Web sites for emulators we haven't mentioned here. You'll find developer-oriented Web sites such as Palo Wireless (http://www.palowireless.com), which lists many available tools and emulators, another good source of information.

One advantage of the toolkits such as those from Nokia or Openwave is that they include a WML encoder—functionality that normally resides in the WAP gateway in a live configuration. With a WML encoder, you can display the source WML markup that the ASP.NET mobile controls generate. This feature is very valuable to advanced developers who create device adapters and custom controls like the ones described in Chapter 21 and Chapter 22. Using this tool, developers can quickly verify that the generated markup is correct. This feature is also valuable to developers who use the templated controls where the code generates device-specific markup. If an error occurs at run time, the built-in WML compilers in these toolkits will show you where the error lies in the source code.

Verifying Support for an Emulator


Whenever you use an emulator, you shouldn't assume that ASP.NET mobile controls have been configured to support it. There are two ways in which it can become apparent that support for the emulator isn't present:



The real device works, but an emulator of that device does not.



The emulator appears to work, but formatting problems are apparent with mobile pages.



The first of these problems is easier to identify and to fix. ASP.NET identifies browsers by examining the User Agent string the client sends in the HTTP headers with every request. Normally, an emulator returns the same User Agent string as the real device it is emulating, but this is not always true (particularly if the emulator has been produced by a different company from the manufacturer of the real device). If the emulator specifies an unrecognized User Agent string in the HTTP headers, the ASP.NET runtime classifies it as an "unknown" HTML 3.2 device. If the emulator expects to receive WML and instead gets HTML 3.2, the browser can't understand the markup it has received and displays an Unrecognized Content Type error. The next section, "Chapter 19. On rare occasions, ASP.NET might correctly identify the manufacturer of the device but not identify the specific model. As a result, the MobileCapabilities object that the ASP.NET runtime builds to identify the capabilities of the device is not optimized for that particular model, resulting in the ASP.NET mobile controls not rendering optimum markup for that particular browser. You might find that an ASP.NET Mobile Web application appears to work with the device's emulator, but you might later realize that pages aren't formatted correctly or that navigation buttons or softkeys don't work as expected. You might conclude incorrectly that your application isn't working for some reason; but the reason for the problem might just be that your device is getting only the basic level of support for a browser from that manufacturer.

This is a subtle problem that can be hard to identify. The Chapter 19.


Verifying Emulator Identification


If you encounter the situation in which your application works fine with a real device but doesn't work with an emulation of the same device, the reason is probably that the emulator is not sending the same User Agent string as the real device. For example, the ASP.NET mobile controls support the Ericsson R380 mobile phone. However, when you try to access a mobile ASP.NET application with the Ericsson R380 emulation in the Yospace Smartphone emulator, the runtime reports an error, saying that it can't display the page. Similarly, the Motorola Timeport emulation in the Yospace Smartphone emulator reports error 406 (Unrecognized Content Type). However, the emulations of the Nokia 7110 and 6210 phones work fine with this emulator.

The way that ASP.NET identifies these browsers at run time accounts for these discrepancies. If you're using .NET Framework 1.0, when you install the ASP.NET Mobile Controls, it updates the main configuration file, machine.config, which resides in the /WINDOWS/Microsoft.NET/Framework/v1.0.3705/CONFIG directory. If you're using .NET Framework 1.1, device configuration is found in the machine.config file, and might also be found in the file deviceupdate.config in the /WINDOWS/Microsoft.NET/Framework/v1.1.4322/CONFIG directory.

If you examine the machine.config file or deviceupdate.config file, you'll see that it contains browser identification logic within a section enclosed by the following tags:

<browserCaps> … </browserCaps>

ASP.NET identifies browsers by using regular expressions to match the HTTP_USER_AGENT string that the client browser sends with every request. Once ASP.NET identifies a browser, the runtime extracts all the values for its capabilities from the <browserCaps> element and uses them to initialize the MobileCapabilities object. In Chapter 9, we introduced you to the MobileCapabilities object and the way it defines the characteristics and capabilities of a mobile device. You define each of the properties that you can query through the MobileCapabilities object, including ScreenPixelsHeight, IsColor, and MobileDeviceModel, in the <browserCaps> section of the configuration file. For example, the section that identifies the Ericsson R380 mobile phone looks like this:

<!-- Ericsson -->
<case
match=
"R380 (?'browserMajorVersion'\w*)(?'browserMinorVersion'\.\w*) WAP 1\.1">
browser = "Ericsson"
type = "Ericsson R380"
version = ${browserMajorVersion}.${browserMinorVersion}
majorVersion = ${browserMajorVersion}
minorVersion = ${browserMinorVersion}
isMobileDevice = "true"
preferredRenderingType = "wml11"
preferredRenderingMIME = "text/vnd.wap.wml"
preferredImageMIME = "image/vnd.wap.wbmp"
inputType = "virtualKeyboard"
canInitiateVoiceCall = "true"
mobileDeviceManufacturer = "Ericsson"
mobileDeviceModel = "R380"
screenPixelsWidth = "310"
screenPixelsHeight = "100"
screenCharactersHeight = "7"
screenBitDepth = "1"
isColor = "false"
</case>

If the runtime can't match the HTTP_USER_AGENT string for a particular browser, the settings within the <default> device definition in <browserCaps> apply. These settings define the client browser as an HTML 3.2 browser, of browser type Unknown. The Yospace R380 emulator doesn't work because it sends a different HTTP_USER_AGENT string from the real device, and the regular expression used to identify an R380 model as defined in machine.config doesn't recognize it. Consequently, ASP.NET defines the device as an HTML 3.2 device and formats the page in HTML. The WAP browser can't render HTML, which explains the error message that appears when you access the application through this emulator.

You can easily verify whether there is a device identification problem using the trace output you learned about earlier in this chapter, in the section "Using the ASP.NET Trace Facility." The WhoAmI application, shown in Listing 16-6, simply outputs a few of the properties defined in the MobileCapabilities object to mobile Label controls, including the MobileCapabilities.Browser property, which it also writes to the trace log. More important, the runtime configures the Web.config file for application-level tracing, as Listing 16-7 shows.

Listing 16-6: Default.aspx mobile Web Forms page of the WhoAmI application






<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage"  
Language="c#" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls"
Assembly="System.Web.Mobile" %>
<%@ Import Namespace="System.Web.Mobile" %>
<head>
<script language="c#" runat="server">
void Page_Load(object sender, System.EventArgs e)
{
MobileCapabilities cap=((MobileCapabilities)Request.Browser);
lblBrowser.Text = "Browser: " + cap.Browser;
lblManu.Text = "Manufacturer: "+ cap.MobileDeviceManufacturer;
lblModel.Text = "Model: " + cap.MobileDeviceModel;
lblContent.Text = "Content: " + cap.PreferredRenderingType;
lblHeight.Text = "PxlsHeight: " + cap.ScreenPixelsHeight;
lblWidth.Text = "PxlsWidth: " + cap.ScreenPixelsWidth;
// Output MobileCapabilities. Browser property to Trace.
Trace.Write("Browser: " + cap.Browser);
}
</script>
</head>
<body>
<mobile:Form runat="server" id="frmMain">
<mobile:Label runat="server" StyleReference="title">
ASP.NET Mobile Controls Client Identification</mobile:Label>
<mobile:Label runat="server" id="lblBrowser"/>
<mobile:Label runat="server" id="lblManu"/>
<mobile:Label runat="server" id="lblModel"/>
<mobile:Label runat="server" id="lblContent"/>
<mobile:Label runat="server" id="lblHeight"/>
<mobile:Label runat="server" id="lblWidth"/>
</mobile:Form>
</body>











Listing 16-7: Application-level tracing in the Web.config file of the WhoAmI application






<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<!-- APPLICATION-LEVEL TRACING -->
<trace enabled="true" />
</system.web>
</configuration>











If you run this application on a supported device, it displays the values of some of the properties of the MobileCapabilities object, as shown in Figure 16-9 for the Openwave 6.1 browser. However, if you try to access http://localhost/whoami from the Yospace R380 emulator, the application fails to display the output for the reasons just described.


Figure 16-9: WhoAmI application displaying ASP.NET device capabilities settings for this device

If you then use Internet Explorer to access the application-level trace file at http://localhost/whoami/trace.axd and select the most recent trace, you'll see that the MobileCapabilities.Browser property is set to Unknown, as shown in the Trace Information section. You'll also notice that, in the Headers Collection section of the trace, the HTTP_USER_AGENT string for the Yospace R380 emulation appears as Ericsson R380 version 0.0 (compatible; Yospace SmartPhone Emulator Developer Edition 2.0). Figure 16-10 shows this trace output.


Figure 16-10: Trace output showing the HTTP headers sent by the client browser

Here we see the root of the problem! The existing code in <browserCaps> that identifies the R380 model looks for an HTTP_USER_AGENT string that matches R380 majorVersion.minorVersion WAP 1.1, while the Yospace emulator actually identifies itself as Ericsson R380 version 0.0 (compatible; Yospace SmartPhone Emulator Developer Edition 2.0).





Note

Chapter 19 describes the full procedure for extending support to a new device. We advise you to read that chapter before getting too deeply involved in making changes in <browserCaps> and device adapters, particularly if you're trying to add support for a device that wasn't previously supported. In this case, however, the change required is very minor, since the runtime already supports the device that the Yospace emulator is simulating.


To make this change, create or edit your application's Web.config file and write the tags for a <browserCaps> section in a similar way to that in the device configuration file in the /WINDOWS/Microsoft.NET/Framework/

version /CONFIG directory. Remember to include the <use var="HTTP_USER_AGENT" /> and <filter> tags to enable browser matching. The basic structure of the code you need is shown here:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<browserCaps>
<use
var="HTTP_USER_AGENT" />
<filter>
<!-- Insert your own browser definitions here. -->
</filter>
</browserCaps>
</system.web>
</configuration>

Locate the section that identifies the R380 model in the device configuration file, copy it, and paste it into the Web.config file you're writing. Modify the matching string used in the regular expression as shown in boldface type in the following example:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<!--
BEGIN Browser support for Yospace emulations
-->
<browserCaps>
<use
var="HTTP_USER_AGENT" />
<filter>
<!-- YOSPACE Emulations -->
<case match=".*YOSPACE.*">
<filter>
<!-- Ericsson -->
<case
match=
"Ericsson R380 v(?'browserMajorVer'\w*)(?'browserMinorVer'\.\w*) .*" >
browser = "Ericsson"
type = "Ericsson R380"
version =
${browserMajorVer}.${browserMinorVer}
majorVersion = ${browserMajorVer}
minorVersion = ${browserMinorVer}
preferredRenderingType = "wml11"
preferredRenderingMime = "text/vnd.wap.wml"
preferredImageMime = "image/vnd.wap.wbmp"
inputType = "virtualKeyboard"
canInitiateVoiceCall = "true"
mobileDeviceManufacturer = "Ericsson"
mobileDeviceModel = "R380"
screenPixelsWidth = "310"
screenPixelsHeight = "100"
screenCharactersHeight = "7"
screenBitDepth = "1"
isColor = "false"
maximumRenderedPageSize = "3000"
</case>
</filter>
</case> <!-- End YOSPACE emulations -->
</filter>
</browserCaps>
</system.web>
</configuration>

This match will work with the Yospace HTTP_USER_AGENT string and set the device up as an R380. You can then save this new Web.config file in your /Inetpub/wwwroot directory, where it will apply to all applications on that server, or you can save the file in the application root directory, where it will apply only to that application. You could even just add this new browser definition to the <browserCaps> section in the deviceupdate.config file (.NET Framework 1.1) or machine.config file (.NET Framework 1.0) alongside the existing definitions supplied by Microsoft.

Remember that if you install a new Device Update issued by Microsoft in the future, the <browserCaps> section in deviceupdate.config or machine.config will be updated to include settings for newly supported devices. Browser definitions in a Web.config file in the wwwroot directory or in the application root directory override any settings for the same browser in machine.config (if any exist). Whenever you install a new Device Update, you should review any custom browser definitions you've implemented because official support for the affected browsers might be included in the device update, in which case you should remove the corresponding custom definition.

With this modification in place, the Mobile Internet Controls Runtime will recognize the Yospace emulation as an R380 and correctly format the response in WML 1.1.


Integrating an Emulator into Visual Studio .NET


You can run some software emulators from the command line, specifying the URL to fetch as a command-line parameter. An example is the Openwave simulator. You can integrate an emulator with this capability into the Visual Studio .NET IDE to make your testing easier. To do so, follow these steps:



Open any ASP.NET project, and right-click any .aspx file in Solution Explorer. Click Browse With on the context menu.



In the Browse With window, click the Add button.



In the Add Program window, browse to the file location of the emulator executable, and click Open. After the file location, add any command-line parameters the emulator requires. Visual Studio .NET automatically sends the URL of the page you are testing as the first command-line parameter, but you can use the %URL variable to insert the location of the starting page elsewhere in the command-line parameters. The Openwave simulator in the SDK 4.1.1 requires the command-line parameters –reload %URL, whereas the simulator in SDK 5.0 and later needs only the URL. For example, to use the WML 1.2 simulator from the Openwave SDK 4.1.1, in the file location, type "C:\Program Files\Openwave\UPSDK411 \upsim411.exe" -reload %URL. (Note carefully the position of the quotation marks.) To use the XHTML-MP browser in the simulator from the Openwave SDK 6.1, in the file location, type C:\Program Files\Openwave\SDK 6.1\program\http \OSDK61http.exe. (Here quotation marks are not needed.)



Type a friendly name for the browser, such as Openwave SDK 4.1.1 simulator, to add to the list of browsers available through the Browse With window.



Click the OK button to accept your changes. If Visual Studio .NET displays the error message File name does not exist, is invalid, or contains parameters that cannot be validated. Do you want to change your entry?, click No.



If you want, you can make this the default browser for the Browse option by selecting the newly added emulator in the list and clicking Set As Default.



You must change a project property to enable your Web application projects to use a browser other than Internet Explorer when you run them for debugging. To change this property, follow these steps:



Right-click the project name in Solution Explorer, and click Properties on the context menu.



Click the Configuration Properties folder in the tree on the left to expand it. Then click the Debugging suboption.



For Visual Basic projects, clear the Always Use Internet Explorer When Debugging Web Pages check box. In a C# project, set the Always Use Internet Explorer option to false. Click OK.



Visual Studio .NET will now use the browser specified as the default in the Browse With window for debugging for all projects.

Alternatively, you can specify debugging with a particular emulator just in a specific project by modifying the project properties as follows:



Open the project properties and set the Always Use Internet Explorer to True so that other projects debug using Internet Explorer as usual.



Set the Debug Mode property to Program.



Set the Start Application property to the full path of the Openwave SDK 4.1.1 executable. If you installed the 4.1.1 SDK in the default location, the path name is: C:\Program Files\Openwave\UPSDK411\upsim411.exe.



Set the Command Line Arguments property to -reload, followed by the absolute URL of the start page of your application—for example, http://localhost/MobileWebApplication1/MobileWebForm1.aspx. You need the URL only and not the –reload command-line parameter if you're using Openwave SDK 5.0 or later.



Click the OK button to accept your changes.



Visual Studio .NET will now use the Openwave browser for debugging in this project but will still use Internet Explorer for other projects.

/ 145