I'm using the code below in combination with a dll file that displays files via web page links. This method is slower to bring up the files than when I link directly to the files when in the web directory.
Is there a way to make this faster? Or is there a different way altogether to secure files and still allow links to open the files?
Thanks,
-Aaron
Is there a way to make this faster? Or is there a different way altogether to secure files and still allow links to open the files?
Code:
Response.buffer = TRUE
Dim vntStream
Dim oMyObject
Dim FileName
Dim LocalFolder
Dim StoreFolder
FileName = Request.QueryString("FileName")
LocalFolder = Server.MapPath(".")
StoreFolder = Request.QueryString("StoreFolder")
Dim CaseFileType
CaseFileType = UCASE(Right(Request.QueryString("FileName"),3))
Select Case CaseFileType
Case "PDF" 'Adobe PDF
Response.ContentType = "application/pdf"
Case "DOC" 'Microsoft Word
Response.ContentType = "application/msword"
Case "XLS" 'Microsoft Excel
Response.ContentType = "application/vnd.ms-excel"
Case "PPT" 'Microsoft PowerPoint
Response.ContentType = "application/ms-powerpoint"
Case "GIF" 'GIF Image
Response.ContentType = "image/gif"
Case "JPG" 'JPEG Image
Response.ContentType = "image/jpeg"
End Select
Set oMyObject = Server.CreateObject("ASPBinFile.clsASPBinFile")
vntStream = oMyObject.readBinFile(LocalFolder &"\"& StoreFolder &"\"& FileName)
Response.Addheader "Content-Disposition", "inline; filename=" & FileName
Response.BinaryWrite(vntStream)
Set oMyObject = Nothing
Response.End
Thanks,
-Aaron