Share via


How to: Work with Emulators and Browsers 

ASP.NET mobile controls enable you to develop applications for a wide variety of mobile devices. The manufacturers of most mobile devices provide emulators that simulate the operation of their hardware and browsers. Emulator software enables you to view your ASP.NET mobile Web pages as they might appear on the manufacturers' hardware devices, and to experience the interface for your Web site as users do. For example, after you see how a user must navigate through your site on a specific device, you might want to modify the interface using a DeviceSpecific template for that device.

Developing and testing with emulators enables you to test your mobile Web application more easily on a variety of devices before you deploy it.

There are two approaches to viewing your mobile Web pages on device emulators:

  • Install and use device emulators provided by manufacturers.

  • Use the emulators installed with some editions of Visual Studio. To use this option, you must have an edition of Visual Studio containing Emulator Manager, and you must have installed the ActiveSync application, which you can download from the tools page on the Microsoft Mobile Developer Center.

Adding an Emulator to Visual Studio

You can add an emulator to the list of browsers available in Visual Studio.

To add a device manufacturer's emulator to the list of available browsers

  1. Compile your application.

  2. Install the mobile device emulator on your development computer. See the emulator's documentation for instructions.

  3. In the File menu, click Browse With.

    Visual Studio displays the Browse With dialog box.

  4. Click Add.

    Visual Studio displays the Add Program dialog box.

  5. In the Program name box, enter the name of the emulator's executable program file.

  6. If the emulator accepts command line arguments, enter them in the Program name field. For example, enter %startpage to specify where the application's start page should be substituted in the command line.

  7. In the Friendly name box, enter the name of the browser as you want it to appear in Visual Studio.

  8. Click OK.

  9. If you want the emulator to be the default browser, click Set as Default.

  10. Click Close.

Removing an Emulator

If you no longer need an emulator, you can remove it from Visual Studio.

To remove an emulator from the browser list

  1. In Solution Explorer, right-click the name of any .aspx file.

  2. In the shortcut menu, click Browse With.

    The designer displays the Browse With dialog box.

  3. Select an emulator from the browser list.

  4. Click Remove.

    Visual Studio removes the emulator name from the browser list.

    NoteNote

    You cannot remove a browser designated as the default browser.

Testing Pages with Emulator Manager

All editions of Visual Studio include support for mobile Web pages. If your edition of Visual Studio also includes support for mobile device applications (such as for the Pocket PC), you have Emulator Manager installed, which includes several emulators. However, the emulators available with Emulator Manager were not originally intended for testing mobile Web pages. To use Emulator Manager to test your mobile Web pages, you can install ActiveSync, which is available for download from the tools page on the Microsoft Mobile Developer Center.

To view your Web site with an emulator using Emulator Manager

  1. Compile your application.

  2. In the Tools menu, click Emulator Manager.

    NoteNote

    If the Emulator Manager command is not available, you do not have the Compact Framework installed.

  3. Select a device emulator.

  4. In the Actions menu, click Connect.

    The emulator appears. Move the emulator so you can see Emulator Manager, and wait for it to indicate that the selected device is connected.

  5. In Emulator Manager, right-click the connected device emulator in the list and in the shortcut menu, click Cradle.

    ActiveSync starts.

  6. In the Set Up a Partnership dialog box, select Guest partnership and click Next.

  7. When ActiveSync indicates the device is connected, close ActiveSync. (It will continue running in the background.)

  8. In the emulator, navigate to your Web site.

    NoteNote

    An emulator might not be able to use the localhost URL to access your Web site project. If not, you can view the Web site using the intranet URL.

Debugging Web Pages in the Emulator

If Visual Studio cannot launch an emulator when debugging a Web site, you can debug your application by attaching to the ASP.NET worker process.

To debug your Web site application by attaching to the worker process

  1. Set a breakpoint in the code you want to debug.

  2. Compile your application.

  3. On the Tools menu, select Attach to Process.

  4. In the Available Processes list, select the Web site worker process (w3wp.exe or aspnet_wp.exe).

  5. Click Attach.

    The Visual Studio debugger starts.

  6. In the emulator or browser, navigate to your Web site project.

    The debugger stops at the first breakpoint.

For more information about using an emulator, see the manufacturer's emulator documentation.

See Also

Concepts

ASP.NET Browser Registration Tool (Aspnet_regbrowsers.exe)
Viewing Mobile Web Applications
Working with Environment Tools