Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Trouble File system Object


Message #1 by syed moiz <sa_moiz@y...> on Sat, 21 Dec 2002 03:38:53 -0800 (PST)
Hi,
Iam facing some problem in executing this ASP.
my task is to allow automatic download from my site,
on my site the files to be downloaded are present in
download folder and iam downloading hhh.txt
file on to system.

this error is thrown when ASP file is Executed

########
Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied,Error on Line 9
########
ASP Code:

<%
	Response.Buffer = True
	Response.Clear
	
	' set the directory that contains the files here
	strFileName = Server.MapPath( "download" &
Request.QueryString("hhh.txt" ) )
	
	Set Sys = Server.CreateObject(
"Scripting.FileSystemObject" )
	Set Bin = Sys.OpenTextFile( strFileName, 2, True )
	If Sys.FileExists( strFileName ) Then
		' This is the importent part :-)
		
		'  Set the Filename to save as
		Call Response.AddHeader( "Content-Disposition",
"attachment; filename=" & 

strFileName )
		
		' Make sure the browser downloads, instead of
running it
		Response.ContentType = "application/octet-stream"
		
		' Send as a Binary Byte Stream
		While Not Bin.AtEndOfStream
			Response.BinaryWrite( ChrB( Asc( Bin.Read( 1 ) ) )
)
		Wend
	Else
		Response.Redirect( "filenotfound.html" )
	End If
	Bin.Close : Set Bin = Nothing
	Set Sys = Nothing
%>

What might be the error.
Thanks in advance

Regards

Syed


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

  Return to Index