Creating the ServiceInfo Document Dynamically
[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
You can use ASP to create your ServiceInfo document. This can give you greater flexibility in your online store by using the following techniques:
- Dynamically generating the host name for URLs.
- Changing URLs for localization based on locale and geoid parameters.
- Dynamically appending query string parameters from the ServiceInfo URL to other URLs, such as the navigate page URL.
The following example code shows a simple ASP page that dynamically creates a ServiceInfo document:
<%
Dim sHost
Dim sLocale
sHost = Request.ServerVariables("HTTP_HOST")
sLocale = Request.QueryString("locale")
%>
<?xml version="1.0" encoding="utf-8"?>
<ServiceInfo Version="1.00" Key="MyCommerceService">
<FriendlyName>My Online Store</FriendlyName>
<ServiceTask1
URL = "https://<%= sHost %>/service/html/Music.asp">
</ServiceTask1>
<ServiceTask2
URL = "https://<%= sHost %>/service/html/Video.asp">
</ServiceTask2>
<ServiceTask3
URL = "https://<%= sHost %>/service/html/Radio.asp">
</ServiceTask3>
<Navigate
BaseURL = "https://<%= sHost %>/service/html/navigate.asp?myloc<%= sLocale %>">
</Navigate>
</ServiceInfo>
The preceding example code uses ASP to retrieve the host name from the web server and dynamically create the URLs in the document. The code also retrieves the locale query string parameter from the ServiceInfo request and appends it to the URL for the navigate page.
Related topics