Windows Media Rights Manager SDK banner art

Download.Download

The Download method adds the modified content header to the packaged file and downloads the file to the consumer's computer.

Syntax

Download.Download(bstrPathFileName, bstrContentHeader)

Parameters

bstrPathFileName

[in] String containing the path and file name of the packaged file.

bstrContentHeader

[in] String containing the new content header.

Return Values

This method does not return a value. If the method fails, it returns a number in the error object.

Return code Description
0x80041108 Invalid content header.
0x8004110B Unsupported content header version.
0xC004291F This method does not support Windows Media Rights Manager 1.
0xC0042911 The InputFile property must be set before calling this method.
0xC004291A The input file must be protected.
0xC004291E The object was not created with Server.CreateObject.
0xC0042905 The property has not been set.

Remarks

After creating a new content header or retrieving the existing content header from the packaged file by using the Download.GetDRMHeader method and modifying it (for example, adding new attributes), add the new or modified content header to the packaged file by using this method.

Example Code

<%option explicit%>
<%Response.Buffer = True%>
<%
    ' Declare objects and variables.
    Dim strPath, strContent, strUserName, publickey, privatekey
    Dim objDownloadMgr, objHeader, strHeader

    ' Retrieve end user and file information from the form.
    strPath = Request.QueryString("path")
    strContent = Request.QueryString("content")
    strUserName= Request.QueryString("username")
 
    ' Create a download manager object.
    Set objDownloadMgr = 
       Server.CreateObject("wmrmobjs.reheader") 

    ' Create a header object.
    Set objHeader = Server.CreateObject("Wmrmobjs.WMRMHeader")
        ' Place header information into the header object.
    
    strHeader = objDownloadMgr.GetDRMHeader(strPath+"\"+strContent)
    objHeader.Header = strHeader
    objHeader.Attribute("UserName") = strUserName
    privatekey = "XXX"    ' XXX is the packaging server's private key.
    objHeader.Sign(privatekey)
    strHeader = objHeader.Header

    ' Add the header to the Response object.
    Response.AddHeader "Content-Disposition", _
                       "attachment;filename="+strContent

    ' Force the end user to download the packaged file.
    objDownloadMgr.ForceCompleteDownload = True

    ' Download the file.
    call objDownloadMgr.DownLoad(strPath+"\"+strContent, strHeader)
%>

Requirements

Version: Windows Media Rights Manager 7 SDK or later

Reference: DRMReheader 1.0 Type Library

Library: wmrmrehd.dll

Platform: Windows Server 2003

See Also