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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP via ASP without using components 1

Status
Not open for further replies.

estellemorris

Programmer
May 10, 2006
11
GB
I have found a solution but having problems with permissions on my shared web server.

Here is a snippet of my ASP page.

CODE
Dim fso, TF, DataFileName
DataFileName = "c:\SAMPLE.TXT"
FTPFileName = "C:\CMDS.FTP"

Set fso = CreateObject("Scripting.FileSystemObject")
Set TF = fso.CreateTextFile(DataFileName , True)
TF.WriteLine("SOME TEXT DATA")
TF.close

'FTP Text file to Server
Set TF = fso.CreateTextFile(FTPfilename, True)

TF.WriteLine("open <SERVER>")
TF.WriteLine("USER")
TF.WriteLine("PASSWORD")
TF.WriteLine("cd /dropdir")
TF.WriteLine(" put " & DataFileName )
TF.WriteLine(" quit ")

TF.CLOSE

Set objShell = CreateObject("Wscript.Shell")
FtpCommand = "FTP -s:" & FTPfilename & " -i -d "
objShell.Run FTPCommand


This method fails with a "VBscript Runtime error '800a0046' Permission denied" at the line objShell.Run FTPCommand when I run it from my website.

Any advice ?

Thanks
 
Hi There,

I have two things to add to this thread; one may help your specific situation, the other may help those with a similar problem but who have access to and can change settings in IIS.

First, if you can't perform the remote upload with WScript or ASPUpload, have you considered using pure ASP? there's a detailed article on how to do this at:
Second, for those that can change settings in IIS and are trying to execute code off of a web page, try changing the security context in which your application runs (you can even change this for an individual file). Right-click on the file or directory you wish to elevate permissions for and chose "Directory" or "File" Security respectively; then either disable anonymous access to the item so that users must run the page as themselves or change the Anonymous user account to one with privileges that allow for the execution of the application you are trying to run (not a good idea for an externally accessible site).

Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top