Partager via


Windows Media Rights Manager SDK banner art

Modifying the Content Header Dynamically

Besides containing the required information for packaging a file, a content header can contain other information included as custom attributes . And, because the content header is signed, it is a secure channel of communication between the participants in a digital rights management business model.

For example, a content owner packages Windows Media files, and then various vendors distribute them. To track which vendors are responsible for the sales of each packaged file, the content headers are modified by including a custom attribute for the retailer ID, such as:

WMRMHeader.Attribute("Retailer") = "Brand-X"

Modifying a content header can be done by different parties or at different times in the packaging process, depending on the business model. For example, content owners can create different versions of a packaged file and send each vendor a version with its retailer ID in the content header. Or, each vendor can modify the content header of the packaged files received from the content owner. Another possibility for tracking information in the content header is to dynamically modify it at the time the packaged file is requested by a consumer, which is useful because it does not require you to create multiple versions of each packaged file. Also, this approach enables you to include user information in the content header as well, for example a customer ID.

Note   You can modify content headers dynamically with Windows Media Rights Manager 7 SDK, but the modified packaged files must be saved to disk. The Download object was introduced in version 7.1, and this process is performed in memory to enable faster performance.

The basic process for modifying a content header dynamically is as follows:

  1. Determine the path and file name of the packaged file to modify.

  2. Use the Download.GetDRMHeader method to obtain the current content header and modify it as needed. For example, to add new attributes.

    If you want to create a new content header and do not need the original one, you can skip this step.

  3. Sign the new header.

  4. Generate the new header.

  5. Add the new header to the packaged file by using the Download.Download or Download.DownloadEx method (the Download.DownloadEx method has additional options).

    You can also use the Download. ForceCompleteDownload property to override cache control and force a file to be completely downloaded again in the event it was partially downloaded previously.

See Also