Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Download Speed... Response.BinaryWrite

Status
Not open for further replies.

PSFMIS

MIS
Feb 3, 2006
28
US
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?

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
 
Its hard to say without knowing your userbase and what OTHER services are provided by clsASPBinFile...

Is this a public site or are the users internal to your network? How exactly does this thing "secure" your files?
 
It allows the page to get and display files that are not in folders accessible to Internet Users.


Thanks,
-Aaron
 
I'm not sure about making it faster, but i have had cross browser incapatibility with this type of script... ie FF had problems along with others... can't tell you exact details Because its been a while...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top