Example Using BinaryLink in template code
You create a binary link by using the getLinkAsString method in the BinaryLink class in Template Building Block code and including this code in a Component Template or Page Template.
The following example of using the
BinaryLink class shows the code that is generated on a Page before it is viewed and which the Dynamic Link Resolver uses to resolve the binary link:
<%@ Import namespace="Tridion.ContentDelivery.Web.Linking"%>
<%
BinaryLink binaryLink = null;
%>
<%
int publicationId = 3;
binaryLink = new BinaryLink(publicationId);
%>
<!-- A binary link -->
<%Response.Write(binaryLink.GetLinkAsString("tcm:115-16684","","binaryAnchor",
"Link for the text","onClick=\"alert('I am a link')\"",true));%>
<!-- end of binary link -->
<%
binaryLink.Dispose();
%>