I have a situation where as part of a product purchase we need to enable customers to download a .pdf file as part of the purchase. Sometimes though the file is a .zip so I want the page to check to see if there is a .zip file with that product code (if the product code is abc1234, the pdf would be doc_abc123.pdf and the zip might be materials_abc123.zip with the "abc123" being a variable).

I tried using the FileExists method but something is off with my syntax and I am not sure how to make it work.

<%
dim fs
set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists("http://domain/folder/materials_<%= displayProductCode %>.zip") then
<a href="http://domain/folder/materials_<%= displayProductCode %>.zip" target="_blank"><img src="images/download_handbook_btn.png" alt="Download Handbook" /></a>&nbsp;
else
<a href="http://domain/folder/handbook_<%= displayProductCode %>.pdf" target="_blank"><img src="images/download_handbook_btn.png" alt="Download Handbook" /></a>&nbsp;
end if
set fs=nothing
%>


It does not seems to like the ending ASP tag after the first <%= displayProductCode %>.

Can someone help me out with this?

Thanks in advance.

Scott