Chris Jones
asked on
how to ftp using a https address in vb
hello
I have this vb.net [program and i had it working perfect using plain ftp but the company changed the way they supply the file so now its ftp over https.how would i do that in vb.net
I have this vb.net [program and i had it working perfect using plain ftp but the company changed the way they supply the file so now its ftp over https.how would i do that in vb.net
ASKER
ok i get this error when i do that
Unable to cast object of type 'System.Net.HttpWebRequest ' to type 'System.Net.FtpWebRequest' .
This is the httpaddress
https://ets-scorelink.ets.org/edsasftp/TOEFL/TOE6188.TST
Unable to cast object of type 'System.Net.HttpWebRequest
This is the httpaddress
https://ets-scorelink.ets.org/edsasftp/TOEFL/TOE6188.TST
That would indicate that you are indeed just using HTTPS with no FTP involved.
Try the following instead
If you need to supply credentials then you would have to set the Credentials property of the request before the request.GetResponse line, similar to the below.
Try the following instead
request = WebRequest.Create(https://ets-scorelink.ets.org/edsasftp/TOEFL/TOE6188.TST);
HTTPWebResponse response = request.GetResponse();
If you need to supply credentials then you would have to set the Credentials property of the request before the request.GetResponse line, similar to the below.
request.Credentials = NetworkCredential("Username", "Password");
ASKER
hmm this is what i have where should i put this cod3e or what code needs to be replaced. Also the varable link is the URL
Dim FTPRequest As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(line), System.Net.FtpWebRequest)
FTPRequest.Method = System.Net.WebRequestMethods.Ftp.DownloadFile
FTPRequest.EnableSsl = True
Dim response As System.Net.FtpWebResponse = DirectCast(FTPRequest.GetResponse(), System.Net.FtpWebResponse)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I've just noticed that I've put "line" rather than "link" as the variable in the WebRequest.Create as I copied that section from the comment.
ASKER
wait it was line in my code as well sorry.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
the Robo-FTP is a great ideal but more than what i was neding but may use it in another program.
Open in new window
Class info at MSDN