3

How to download a file from a web server to another iis server

e.g. I have lot of movie files which i want to host on my website

the movies are uploaded on other site and I want to grab them on my own site.

Is it possible to schedule asynchronously downloading of files on server using ASP.NET web page? I have only FTP access to the web sever as I'm using shared hosting.

0

4 Answers 4

3

One things you can do is make use of Window Services i.e create Window service and put timer in that will resolve you issue easily.

here is good article : Combine Web and Windows Services to Run Your ASP.NET Code at Scheduled Intervals

Sign up to request clarification or add additional context in comments.

1 Comment

OP has specified that he only has FTP access on the server.
1
+50

If you are using shared hosting, scheduling tasks is going to be difficult. You could implement a service page that performs the download when it is requested. This page would run on the destination server and request a list of files from the source server and proceed to download those files. The server performs all the work, the client that requests the service page could just get a short log of what the server is doing.

Next setup a scheduled task on some other system that invokes the service page at regular intervals.

Since the call to the service page is a very low load on the client you could do that from just about anywhere (a home or office server, a smart router (dd-wrt) you have sitting in closet somewhere or even your smart phone).

Nice bonus of this approach is that you can manually trigger downloading from anywhere by accessing the service page from your browser directly.

On the downside, if the time to complete the downloads exceed the maximum request duration your request is likely to be terminated. You may want to look into asynchronous handlers if that happens.

Comments

0

You could wire a task to run on every page load or application start (and recycle the app pool regularly), but ASP.NET isn't designed for this type of task.

You would be better served building a service or command line tool that can be attached to Task Scheduler to do the downloads every so often.

Comments

0

1) Add entries to a queue in your ASP.Net application - either MSMQ or database table.

2) Write a windows service/console application that reads from the queue and processes each item.

You could also achieve (2) with ScheduledTask in SQL - ton of other ways too no doubt - the key thing is that you put the queue in the middle to provide the disconnection and asychrony.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.