Steps in Authorizing eBook Downloads:

  1. In the second part of our Quick Start Guide, we will see how to generate a special link that will authorize eBooks you secured in the first part to be downloaded. This part will require some basic programming knowledge, where we will be providing code samples in the C# and PHP languages.
  2. Start up your favorite IDE, create a new file and add the code snippet of your preferred language within it.

    PHP:
<span style="font-size: 10px;"><span class="sh_symbol" style="color: rgb(139, 0, 0);"><!</span>DOCTYPE html<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span> 
<span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span>html<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
    <span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span>head<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
        <span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span>meta http<span class="sh_symbol" style="color: rgb(139, 0, 0);">-</span>equiv<span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_string" style="color: red; font-family: monospace;">"Content-Type"</span> content<span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_string" style="color: red; font-family: monospace;">"text/html; charset=UTF-8"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
        <span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span>title<span class="sh_symbol" style="color: rgb(139, 0, 0);">></</span>title<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
    <span class="sh_symbol" style="color: rgb(139, 0, 0);"></</span>head<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
    <span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span>body<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
        <span class="sh_symbol" style="color: rgb(139, 0, 0);"><?php</span>
        <span class="sh_variable" style="color: rgb(0, 100, 0);">$dateval</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_function" style="font-weight: bold;">time</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">();</span>
        <span class="sh_variable" style="color: rgb(0, 100, 0);">$sharedSecret</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_string" style="color: red; font-family: monospace;">""</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span> <span class="sh_comment" style="color: rgb(165, 42, 42); font-style: italic;">// Place your unique distributor shared secret, keep this safe or the api can be used in your stead by others!</span>
        <span class="sh_variable" style="color: rgb(0, 100, 0);">$transactionId</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_string" style="color: red; font-family: monospace;">""</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span> <span class="sh_comment" style="color: rgb(165, 42, 42); font-style: italic;">// Must be a unique value, generated by you for your records</span>
        <span class="sh_variable" style="color: rgb(0, 100, 0);">$resourceId</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_string" style="color: red; font-family: monospace;">""</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span> <span class="sh_comment" style="color: rgb(165, 42, 42); font-style: italic;">// Place Content Server Resource ID starting with urn:uuid:</span>
        <span class="sh_variable" style="color: rgb(0, 100, 0);">$linkURL</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_string" style="color: red; font-family: monospace;">"http://acs4.editionguard.com/fulfillment/URLLink.acsm"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span> <span class="sh_comment" style="color: rgb(165, 42, 42); font-style: italic;">// Content server service url, do not change.</span>
        <span class="sh_variable" style="color: rgb(0, 100, 0);">$orderSource</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_string" style="color: red; font-family: monospace;">""</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span> <span class="sh_comment" style="color: rgb(165, 42, 42); font-style: italic;">// Your EditionGuard subscription e-mail address.</span>
       
        <span class="sh_comment" style="color: rgb(165, 42, 42); font-style: italic;">// Create download URL</span>
        <span class="sh_variable" style="color: rgb(0, 100, 0);">$URL</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_string" style="color: red; font-family: monospace;">"action=enterorder&ordersource="</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">urlencode</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_variable" style="color: rgb(0, 100, 0);">$orderSource</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">).</span><span class="sh_string" style="color: red; font-family: monospace;">"&orderid="</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">urlencode</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_variable" style="color: rgb(0, 100, 0);">$transactionId</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">).</span><span class="sh_string" style="color: red; font-family: monospace;">"&resid="</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">urlencode</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_string" style="color: red; font-family: monospace;">"$resourceId"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">).</span><span class="sh_string" style="color: red; font-family: monospace;">"&dateval="</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">urlencode</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_variable" style="color: rgb(0, 100, 0);">$dateval</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">).</span><span class="sh_string" style="color: red; font-family: monospace;">"&gblver=4"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span>

        <span class="sh_comment" style="color: rgb(165, 42, 42); font-style: italic;">// Digitally sign the request</span>
        <span class="sh_variable" style="color: rgb(0, 100, 0);">$URL</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_variable" style="color: rgb(0, 100, 0);">$linkURL</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_string" style="color: red; font-family: monospace;">"?"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_variable" style="color: rgb(0, 100, 0);">$URL</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_string" style="color: red; font-family: monospace;">"&auth="</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">hash_hmac</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_string" style="color: red; font-family: monospace;">"sha1"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">,</span> <span class="sh_variable" style="color: rgb(0, 100, 0);">$URL</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">,</span> <span class="sh_function" style="font-weight: bold;">base64_decode</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_variable" style="color: rgb(0, 100, 0);">$sharedSecret</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">));</span>
        <span class="sh_symbol" style="color: rgb(139, 0, 0);">?></span>
       
        <span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span>a href<span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_string" style="color: red; font-family: monospace;">"<?php print $URL; ?>"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">></span> Click here to download eBook<span class="sh_symbol" style="color: rgb(139, 0, 0);"></</span>a<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
       
    <span class="sh_symbol" style="color: rgb(139, 0, 0);"></</span>body<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
<span class="sh_symbol" style="color: rgb(139, 0, 0);"></</span>html<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span></span>

ASP.NET C#

<span class="sh_symbol" style="color: rgb(139, 0, 0);"><%</span>@ <span class="sh_usertype" style="color: teal;">Page</span> Language<span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_string" style="color: red; font-family: monospace;">"C#"</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">%></span> 
<span class="sh_symbol" style="color: rgb(139, 0, 0);"><%</span>@ <span class="sh_usertype" style="color: teal;">Import</span> Namespace<span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_string" style="color: red; font-family: monospace;">"System.Security.Cryptography"</span>  <span class="sh_symbol" style="color: rgb(139, 0, 0);">%></span>
<span class="sh_symbol" style="color: rgb(139, 0, 0);"><%</span>@ <span class="sh_usertype" style="color: teal;">Import</span> Namespace<span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_string" style="color: red; font-family: monospace;">"System.Globalization"</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">%></span>
<span class="sh_symbol" style="color: rgb(139, 0, 0);"><!</span>DOCTYPE <span class="sh_usertype" style="color: teal;">html</span> PUBLIC <span class="sh_string" style="color: red; font-family: monospace;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> <span class="sh_string" style="color: red; font-family: monospace;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>

<span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span><span class="sh_usertype" style="color: teal;">script</span> runat<span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_string" style="color: red; font-family: monospace;">"server"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
    <span class="sh_keyword" style="color: blue; font-weight: bold;">public</span> <span class="sh_keyword" style="color: blue; font-weight: bold;">static</span> <span class="sh_type" style="color: rgb(0, 100, 0);">string</span> <span class="sh_function" style="font-weight: bold;">SignedEbookLink</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">()</span>
    <span class="sh_cbracket" style="color: red;">{</span>
        <span class="sh_type" style="color: rgb(0, 100, 0);">string</span> sharedSecret <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_string" style="color: red; font-family: monospace;">""</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span> <span class="sh_comment" style="color: rgb(165, 42, 42); font-style: italic;">// Place your unique distributor shared secret, keep this safe or the api can be used in your stead by others!</span>
        <span class="sh_type" style="color: rgb(0, 100, 0);">string</span> transactionId <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_string" style="color: red; font-family: monospace;">""</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span> <span class="sh_comment" style="color: rgb(165, 42, 42); font-style: italic;">// Must be a unique value, generated by you for your records</span>
        <span class="sh_type" style="color: rgb(0, 100, 0);">string</span> resourceId <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_string" style="color: red; font-family: monospace;">""</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span> <span class="sh_comment" style="color: rgb(165, 42, 42); font-style: italic;">// Place Content Server Resource ID starting with urn:uuid:</span>
        <span class="sh_type" style="color: rgb(0, 100, 0);">string</span> orderSource <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_string" style="color: red; font-family: monospace;">""</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span> <span class="sh_comment" style="color: rgb(165, 42, 42); font-style: italic;">// Your EditionGuard subscription e-mail address.</span>
       
        <span class="sh_type" style="color: rgb(0, 100, 0);">string</span> querystring <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_type" style="color: rgb(0, 100, 0);">string</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">Format</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_string" style="color: red; font-family: monospace;">"action=enterorder&ordersource={0}&orderid={1}&resid={2}&gbauthdate={3}&dateval={4}&gblver=4"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">,</span> HttpUtility<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">UrlEncode</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>orderSource<span class="sh_symbol" style="color: rgb(139, 0, 0);">),</span> transactionId<span class="sh_symbol" style="color: rgb(139, 0, 0);">,</span> HttpUtility<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">UrlEncode</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>resourceId<span class="sh_symbol" style="color: rgb(139, 0, 0);">),</span> HttpUtility<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">UrlEncode</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>DateTime<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span>Now<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">ToUniversalTime</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">().</span><span class="sh_function" style="font-weight: bold;">ToString</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_string" style="color: red; font-family: monospace;">"MM/dd/yyyy HH:mm"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">,</span> DateTimeFormatInfo<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span>InvariantInfo<span class="sh_symbol" style="color: rgb(139, 0, 0);">)),</span> <span class="sh_function" style="font-weight: bold;">ToUnixTime</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>DateTime<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span>Now<span class="sh_symbol" style="color: rgb(139, 0, 0);">));</span>
        <span class="sh_keyword" style="color: blue; font-weight: bold;">return</span> <span class="sh_type" style="color: rgb(0, 100, 0);">string</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">Format</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_string" style="color: red; font-family: monospace;">"http://acs4.editionguard.com/fulfillment/URLLink.acsm?{0}&auth={1}"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">,</span> querystring<span class="sh_symbol" style="color: rgb(139, 0, 0);">,</span> <span class="sh_function" style="font-weight: bold;">HashingHmacSha1</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>querystring<span class="sh_symbol" style="color: rgb(139, 0, 0);">,</span> sharedSecret<span class="sh_symbol" style="color: rgb(139, 0, 0);">));</span>
    <span class="sh_cbracket" style="color: red;">}</span>

    <span class="sh_keyword" style="color: blue; font-weight: bold;">private</span> <span class="sh_keyword" style="color: blue; font-weight: bold;">static</span> <span class="sh_type" style="color: rgb(0, 100, 0);">string</span> <span class="sh_function" style="font-weight: bold;">HashingHmacSha1</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_type" style="color: rgb(0, 100, 0);">string</span> <span class="sh_keyword" style="color: blue; font-weight: bold;">value</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">,</span> <span class="sh_type" style="color: rgb(0, 100, 0);">string</span> key<span class="sh_symbol" style="color: rgb(139, 0, 0);">)</span>
    <span class="sh_cbracket" style="color: red;">{</span>
        <span class="sh_type" style="color: rgb(0, 100, 0);">byte</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">[]</span> sharedSecretBytes <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> Convert<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">FromBase64String</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>key<span class="sh_symbol" style="color: rgb(139, 0, 0);">);</span>
        <span class="sh_usertype" style="color: teal;">ASCIIEncoding</span> encoding <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_keyword" style="color: blue; font-weight: bold;">new</span> <span class="sh_function" style="font-weight: bold;">ASCIIEncoding</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">();</span>
        <span class="sh_usertype" style="color: teal;">HMACSHA1</span> hmacsha1 <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_keyword" style="color: blue; font-weight: bold;">new</span> <span class="sh_function" style="font-weight: bold;">HMACSHA1</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>sharedSecretBytes<span class="sh_symbol" style="color: rgb(139, 0, 0);">);</span>
        <span class="sh_type" style="color: rgb(0, 100, 0);">byte</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">[]</span> messageBytes <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> encoding<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">GetBytes</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_keyword" style="color: blue; font-weight: bold;">value</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">);</span>
        <span class="sh_type" style="color: rgb(0, 100, 0);">byte</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">[]</span> hashmessage <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> hmacsha1<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">ComputeHash</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>messageBytes<span class="sh_symbol" style="color: rgb(139, 0, 0);">);</span>
        <span class="sh_keyword" style="color: blue; font-weight: bold;">return</span> <span class="sh_function" style="font-weight: bold;">ByteToString</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>hashmessage<span class="sh_symbol" style="color: rgb(139, 0, 0);">);</span>
    <span class="sh_cbracket" style="color: red;">}</span>

    <span class="sh_keyword" style="color: blue; font-weight: bold;">private</span> <span class="sh_keyword" style="color: blue; font-weight: bold;">static</span> <span class="sh_type" style="color: rgb(0, 100, 0);">string</span> <span class="sh_function" style="font-weight: bold;">ByteToString</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_type" style="color: rgb(0, 100, 0);">byte</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">[]</span> buff<span class="sh_symbol" style="color: rgb(139, 0, 0);">)</span>
    <span class="sh_cbracket" style="color: red;">{</span>
        <span class="sh_type" style="color: rgb(0, 100, 0);">string</span> sbinary <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_string" style="color: red; font-family: monospace;">""</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span>
        <span class="sh_keyword" style="color: blue; font-weight: bold;">for</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_type" style="color: rgb(0, 100, 0);">int</span> i <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_number" style="color: purple;">0</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span> i <span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span> buff<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span>Length<span class="sh_symbol" style="color: rgb(139, 0, 0);">;</span> i<span class="sh_symbol" style="color: rgb(139, 0, 0);">++)</span>
        <span class="sh_cbracket" style="color: red;">{</span>
            sbinary <span class="sh_symbol" style="color: rgb(139, 0, 0);">+=</span> buff<span class="sh_symbol" style="color: rgb(139, 0, 0);">[</span>i<span class="sh_symbol" style="color: rgb(139, 0, 0);">].</span><span class="sh_function" style="font-weight: bold;">ToString</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_string" style="color: red; font-family: monospace;">"X2"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">);</span>
        <span class="sh_cbracket" style="color: red;">}</span>
        <span class="sh_keyword" style="color: blue; font-weight: bold;">return</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>sbinary<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">ToLower</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">());</span>
    <span class="sh_cbracket" style="color: red;">}</span>

    <span class="sh_keyword" style="color: blue; font-weight: bold;">static</span> <span class="sh_type" style="color: rgb(0, 100, 0);">int</span> <span class="sh_function" style="font-weight: bold;">ToUnixTime</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_usertype" style="color: teal;">DateTime</span> timeToConvert<span class="sh_symbol" style="color: rgb(139, 0, 0);">)</span>
    <span class="sh_cbracket" style="color: red;">{</span>
        <span class="sh_usertype" style="color: teal;">TimeSpan</span> span <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_keyword" style="color: blue; font-weight: bold;">new</span> <span class="sh_function" style="font-weight: bold;">TimeSpan</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>DateTime<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">Parse</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_string" style="color: red; font-family: monospace;">"1/1/1970"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">).</span>Ticks<span class="sh_symbol" style="color: rgb(139, 0, 0);">);</span>
        <span class="sh_usertype" style="color: teal;">DateTime</span> time <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> timeToConvert<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span><span class="sh_function" style="font-weight: bold;">Subtract</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>span<span class="sh_symbol" style="color: rgb(139, 0, 0);">);</span>
        <span class="sh_type" style="color: rgb(0, 100, 0);">int</span> t <span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span><span class="sh_type" style="color: rgb(0, 100, 0);">int</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">)(</span>time<span class="sh_symbol" style="color: rgb(139, 0, 0);">.</span>Ticks <span class="sh_symbol" style="color: rgb(139, 0, 0);">/</span> <span class="sh_number" style="color: purple;">10000000</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">);</span>
        <span class="sh_keyword" style="color: blue; font-weight: bold;">return</span> <span class="sh_symbol" style="color: rgb(139, 0, 0);">(</span>t<span class="sh_symbol" style="color: rgb(139, 0, 0);">);</span>
    <span class="sh_cbracket" style="color: red;">}</span>
<span class="sh_symbol" style="color: rgb(139, 0, 0);"></</span>script<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>

<span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span><span class="sh_usertype" style="color: teal;">html</span> xmlns<span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_string" style="color: red; font-family: monospace;">"http://www.w3.org/1999/xhtml"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
<span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span><span class="sh_usertype" style="color: teal;">head</span> runat<span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_string" style="color: red; font-family: monospace;">"server"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
    <span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span>title<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span> <span class="sh_symbol" style="color: rgb(139, 0, 0);"></</span>title<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
<span class="sh_symbol" style="color: rgb(139, 0, 0);"></</span>head<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
<span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span>body<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
    <span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span><span class="sh_usertype" style="color: teal;">form</span> id<span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_string" style="color: red; font-family: monospace;">"form1"</span> runat<span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_string" style="color: red; font-family: monospace;">"server"</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
    <span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span>div<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
    <span class="sh_symbol" style="color: rgb(139, 0, 0);"><</span><span class="sh_usertype" style="color: teal;">a</span> href<span class="sh_symbol" style="color: rgb(139, 0, 0);">=</span><span class="sh_string" style="color: red; font-family: monospace;">"<% =SignedEbookLink() %> "</span><span class="sh_symbol" style="color: rgb(139, 0, 0);">></span> Click here to <span class="sh_usertype" style="color: teal;">download</span> eBook<span class="sh_symbol" style="color: rgb(139, 0, 0);"></</span>a<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
    <span class="sh_symbol" style="color: rgb(139, 0, 0);"></</span>div<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
    <span class="sh_symbol" style="color: rgb(139, 0, 0);"></</span>form<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
<span class="sh_symbol" style="color: rgb(139, 0, 0);"></</span>body<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
<span class="sh_symbol" style="color: rgb(139, 0, 0);"></</span>html<span class="sh_symbol" style="color: rgb(139, 0, 0);">></span>
  1. Open up your “My Account” page, and enter the values shown there, in the appropriate places inside the code; a.) Set the orderSource variable to be the e-mail address you used for subscribing to EditionGuard, b.) Set the sharedSecret variable to the value shown on the page, c.) Set the resourceId variable to the Resource Id of the eBook we uploaded in Part 1 of this guide, d.) Set the transactionId variable to some random variable. It is important to make sure that this variable is unique, as it will be the unique identifier for this download.
  2. Run the code snippet you created and open up the page in your browser. Notice the “Click here to download eBook” link.
  3. Examine the link. Notice the values you entered in step 2.c. along with an “auth” variable. This variable is the digital signature created using your secret key, and there is no way to download your eBooks without providing this digital signature.
  4. Click the link. A file with an .acsm extension will be downloaded. This is a special file that can be opened in Adobe Digital Editions or ADE. If you don’t have it installed, go ahead and do it now on Adobe’s site.
  5. Once you have ADE installed, open the .acsm file using it. Create and authorize an Adobe ID if you need to.
  6. Your eBook will be downloaded and displayed in ADE.
  7. Congratulations, you’ve completed the Quick Start Guide! Hopefully, you’ve gained a deeper understanding of how the main components of the system works. Please feel free to comment and ask questions if anything is unclear. Cheers!
Did this answer your question?