I'm using a script to force the download of a pdf file. The script: <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% '-------------------------------------------- Response.Buffer = True Dim strFilePath, strFileSize, strFileName Const adTypeBinary = 1 strFilePath = "D:\path\pdffile.pdf" 'strFileSize = optional strFileName = "pdffile.pdf" Response.Clear '******************************* ' Requires MDAC 2.5 to be stable ' I recommend MDAC 2.6 or 2.7 '******************************* Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Type = adTypeBinary objStream.LoadFromFile strFilePath strFileType = lcase(Right(strFileName, 4)) ' Feel Free to Add Your Own Content-Types Here Select Case strFileType Case ".pdf" ContentType = "application/pdf" End Select Response.AddHeader "Content-Disposition", "attachment; filename=" & strFileName Response.AddHeader "Content-Length", strFileSize ' In a Perfect World, Your Client would also have UTF-8 as the default ' In Their Browser Response.Charset = "UTF-8" Response.ContentType = ContentType Response.BinaryWrite objStream.Read Response.Flush objStream.Close Set objStream = Nothing %> Code (markup): Now I want this asp file, let's call it download.asp, to be unable to be hotlinked to, and it shouldn't load if someone just types the url into their browser. What do I add? Help appreciated, thanks.
you could try passing a session variable to download.asp, if lets say if session("check")="" then response.redirect "/" else your script end if ope works for you