Web-Based Navigation

Both the Navigate and NavigateCommand elements in MCML support web-based navigation in addition to resource-based and file-based navigation. You can pass properties to the resulting UI in web-based navigations just as you can for resource-based and file-based navigations.

The Data attribute of the Navigate element for a web-based navigation lets you pass data to the resulting UI. You can also specify the request method by using RequestMethod, which is a reserved keyword that can only be set to "GET" or "POST". The request method is set as part of the Data attribute for a web-based navigation as follows:

<Navigate Source="http://play.mediacentersandbox.com/Greeting.asp">
        <cor:String Name="RequestMethod" String="GET"/>
        <ObjectPath Name="Name" ObjectPath="[YourName.Value]"/>

If a request method is not specified, the default method is POST, which requires an SSL connection for security reasons. When passing sensitive data to the web server, use a POST command because the data is not embedded in the URI of the web request.

The example below shows how to invoke navigation after submitting data from an edit box. The source is set to an ASP page on a web server. The request method is set to GET, so the data is passed as part of the URI. The data contains the value of the Name attribute, which corresponds to the text in the edit box. The actual query string passed to the web server is as follows:


Because web applications can only reference other UI elements that are hosted in the same domain from which the application was originally launched, you must load the sample from the web site, or register it as an application in Windows Media Center.

  • To load the sample directly from the web site, open the Preview Tool and enter the following path as the URI: http://play.mediacentersandbox.com/hello.mcml

  • To register the sample as an application, save the following XML, replacing the GUIDs with ones you generate:

    <application title="Hello World Web Application" id="{PUT_APP_GUID_HERE}">
        <entrypoint id="{PUT_ENTRYPOINT_GUID_HERE}"
                    title="Hello World Web Application" 
                    description="Hello World Web Application"
            <category category="More Programs"/>

    Note   When registering web-based applications, use the starting URI for the application as the value of the context attribute.

    Then, run the following command to register the application, replacing the path and file name where you saved the XML:

    C:\Windows\ehome\RegisterMCEApp.exe /allusers Path_and_Filename.xml

Sample Explorer

  • Page Navigation > Navigate and NavigateCommand

See Also