Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Retrieve file from remote server
Old 02-08-2006, 10:10 AM Retrieve file from remote server
tcb
Experienced Talker

Posts: 34
Trades: 0
Hello,

I would like to retrieve a file from a remote server using an ASP page and save it on my computer. The only thing that I can do so far is retrieve a file that is on my computer, using the following code:

<%
dim stream
set stream = server.createObject("adodb.stream")
stream.open
stream.type = 1
Settings\stream.LoadFromFile "C:\Documents and Settings\Administrator\Desktop\test.txt"
stream.SaveToFile "C:\temp\test_cpy.txt",1
Response.Write "File saved!"
%>

Does anyone know what I can do?

Thanks,
tcb.
tcb is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-11-2006, 02:01 PM Re: Retrieve file from remote server
vivekar's Avatar
Webmaster Talker

Posts: 612
Trades: 0
You cannot access the files from remote computer (with out necessary permissions) via ASP.
It is not possible with the code which you have.
__________________

Please login or register to view this content. Registration is FREE
(Active since 2003) |
Please login or register to view this content. Registration is FREE
vivekar is offline
Reply With Quote
View Public Profile Visit vivekar's homepage!
 
Old 02-11-2006, 08:48 PM Re: Retrieve file from remote server
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
You could retreive a file from a remote URL possibly using a third party object. I've never seen it done in ASP.
In ASP.NET however, it's simply a case of creating a Request object, giving it a URL, and calling a method to get the data stream.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 02-12-2006, 09:46 AM Re: Retrieve file from remote server
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
get the content of a URL
Code:
function GetPageContent(strURL)
 Response.Buffer = True
  Dim objXMLHTTP, xml
  Set xml = Server.CreateObject("Microsoft.XMLHTTP")
  
 	xml.Open "GET", strURL, False
	xml.setRequestHeader "User-Agent", strUserAgent '  "Googlebot/2.1+(+http://www.googlebot.com/bot.html)"
	xml.Send
	if xml.status = 200 then
	GetPageContent= xml.responseText
	else
	GetPageContent= cstr(xml.status) & " (" & xml.StatusText & ")"
	end if
  Set xml = Nothing
end function
to set the UserAgent
Code:
dim ArrayUA(6,1)
ArrayUA(0,0) = "Put your own user agent in here"
ArrayUA(1,0) = "Googlebot/2.1+(+http://www.googlebot.com/bot.html)"
ArrayUA(2,0) = "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)"
ArrayUA(3,0) = "msnbot/0.3 (+http://search.msn.com/msnbot.htm)"
ArrayUA(4,0) = "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
ArrayUA(5,0) = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;)"
ArrayUA(6,0) = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
ArrayUA(0,1) = "LinkCheck"
ArrayUA(1,1) = "Googlebot"
ArrayUA(2,1) = "Yahoo"
ArrayUA(3,1) = "MSN Bot"
ArrayUA(4,1) = "Browser IE Win98"
ArrayUA(5,1) = "Browser IE Win 2K"
ArrayUA(6,1) = "Browser IE Win XP"

dim strUserAgent
strUserAgent = ArrayUA(1,0)
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Retrieve file from remote server
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.38219 seconds with 12 queries