Write code that allows people to download a file

  • (2 Pages)
  • +
  • 1
  • 2

22 Replies - 1928 Views - Last Post: 04 April 2012 - 10:35 AM Rate Topic: -----

#1 AOM_Set  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 151
  • Joined: 18-December 10

Write code that allows people to download a file

Posted 02 April 2012 - 12:56 AM

Hej

I have a small .exe program that I I have written in C#. I don't know how to make it possible for others to download this file. I know that I must put it on a server, but how do I write the code that can make people download this file from the server? Suggestions/tutorials are appreciated (I have not been lucky googling it, I don't know what to search for).

Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: Write code that allows people to download a file

#2 Gryphes  Icon User is offline

  • New D.I.C Head

Reputation: -7
  • View blog
  • Posts: 6
  • Joined: 02-April 12

Re: Write code that allows people to download a file

Posted 02 April 2012 - 01:05 AM

your question is not clear yet can you explain it properly?

if you want people to download this file directly from the server. you have to make a download manger.
Was This Post Helpful? -4
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5464
  • View blog
  • Posts: 11,731
  • Joined: 02-June 10

Re: Write code that allows people to download a file

Posted 02 April 2012 - 01:22 AM

See FAQ # 40. (Click the SHOW button below)


TOP most asked:
What does this error message mean?
FAQ 2: How do I debug
FAQ 3: How do I make Class1/Form1 talk to Class2/Form2


FAQ (Frequently Asked Questions - Updated Mar 2012
Spoiler



Was This Post Helpful? 1
  • +
  • -

#4 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 583
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Write code that allows people to download a file

Posted 02 April 2012 - 01:50 AM

There's no direct equivalent to My.Computer.Network.DownloadFile on MSDN, but there was this:
http://social.msdn.m...4a-9ec427a32689
Was This Post Helpful? 1
  • +
  • -

#5 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6048
  • View blog
  • Posts: 23,473
  • Joined: 23-August 08

Re: Write code that allows people to download a file

Posted 02 April 2012 - 03:48 AM

You mean this? ClickOnce Deployment
Was This Post Helpful? 1
  • +
  • -

#6 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: Write code that allows people to download a file

Posted 02 April 2012 - 05:16 AM

If it's just the .exe file, why not just put it on an FTP site somewhere? No need to write any code at all.
Was This Post Helpful? 0
  • +
  • -

#7 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1252
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Write code that allows people to download a file

Posted 02 April 2012 - 09:13 AM

If it's just a .EXE file you want users to download, throw it up on an FTP server.

You can also use MediaFire to host it there, the added benefit is you get statistics of downloads to help you keep track of how many people actually downloaded your program.

If you want users to install your application, the use something like ClickOnce. It's not easy, it'll take some research. :)
Was This Post Helpful? 1
  • +
  • -

#8 AOM_Set  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 151
  • Joined: 18-December 10

Re: Write code that allows people to download a file

Posted 02 April 2012 - 10:47 AM

Hi everyone
Thanks for the reply. I see that I wasn't clear enough in what I wanted to achieve.
Uploading the file on another site (Like media fire or so) wont do do, since I want people to download it from my homepage. So the question was how to do this, and what to search for (on google or any other search engine), to find the help.

I see that some of you have added some links, I'll take a look at those :)

Ps. Why did Gryphes get negative reputation while trying to help on this thread? Am I the only one who can't see anything
wrong with his post?
Was This Post Helpful? 0
  • +
  • -

#9 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6048
  • View blog
  • Posts: 23,473
  • Joined: 23-August 08

Re: Write code that allows people to download a file

Posted 02 April 2012 - 10:52 AM

Yeah,

Quote

if you want people to download this file directly from the server. you have to make a download manger.


That's wrong.

If you just want to put a file for download on your web page, then upload it to your webserver and provide a link to the file?
Was This Post Helpful? 2
  • +
  • -

#10 AOM_Set  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 151
  • Joined: 18-December 10

Re: Write code that allows people to download a file

Posted 02 April 2012 - 11:56 AM

View PostJackOfAllTrades, on 02 April 2012 - 10:52 AM, said:

Yeah,

Quote

if you want people to download this file directly from the server. you have to make a download manger.


That's wrong.

If you just want to put a file for download on your web page, then upload it to your webserver and provide a link to the file?

Oh. I didnt know that uploading it to a server, and providing the link would actually make it possible to download it. I'll try that. Thanks :-)
Was This Post Helpful? 0
  • +
  • -

#11 AOM_Set  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 151
  • Joined: 18-December 10

Re: Write code that allows people to download a file

Posted 03 April 2012 - 02:33 AM

View PostJackOfAllTrades, on 02 April 2012 - 10:52 AM, said:

Yeah,
That's wrong.

If you just want to put a file for download on your web page, then upload it to your webserver and provide a link to the file?

Hey. I tried this, it doesn't work. I I upload the file to the server, and add the URL as a href, the page will just try to open the file without downloading it. In fact this looked very weird for a .exe file, it got opened in notepad, and a lot of weird symbols showed. How can it be fixed so that instead of trying to open the file, it downloads it?
Is there maybe a special place on the server that I should upload it? (as not in the public folder?)
Was This Post Helpful? 0
  • +
  • -

#12 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 443
  • View blog
  • Posts: 1,492
  • Joined: 28-April 09

Re: Write code that allows people to download a file

Posted 03 April 2012 - 04:15 AM

Different browsers will handle different file types differently depending on what, and if, there is a default application assigned to handle the given file type. Zip the file and provide a link to the zip. Then users can just extract the exe from the zip.

This post has been edited by Nakor: 03 April 2012 - 04:20 AM

Was This Post Helpful? 2
  • +
  • -

#13 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: Write code that allows people to download a file

Posted 03 April 2012 - 05:30 AM

View PostAOM_Set, on 03 April 2012 - 05:33 AM, said:

View PostJackOfAllTrades, on 02 April 2012 - 10:52 AM, said:

Yeah,
That's wrong.

If you just want to put a file for download on your web page, then upload it to your webserver and provide a link to the file?

Hey. I tried this, it doesn't work. I I upload the file to the server, and add the URL as a href, the page will just try to open the file without downloading it. In fact this looked very weird for a .exe file, it got opened in notepad, and a lot of weird symbols showed. How can it be fixed so that instead of trying to open the file, it downloads it?
Is there maybe a special place on the server that I should upload it? (as not in the public folder?)


Think about what you are doing. You are putting an EXE on the internet for other's to download. The browser they use will probably see this as a possible virus or other drive-by download and not allow it. You need to ZIP it and have the user's download the ZIP file.
Was This Post Helpful? 1
  • +
  • -

#14 AOM_Set  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 151
  • Joined: 18-December 10

Re: Write code that allows people to download a file

Posted 03 April 2012 - 10:06 AM

Alright, I have zipped the file now, but the problem still remains.
Firstly, if the user clicks on the URL (as a href), he gets redirected to the homepage where the server is.
This is the URL: https://www.unoeuro....l/RecordAPP.rar

I am pretty new to this, so there is probably something totally stupid about the way I do it. But the user gets redirected to this page (Unoeuro.com), where he needs to log in to the server to be able to get to the file. This is obviously pretty bad, and it still shows those weird symbols (When I log in and click on the file to download it) in notepad, even if it is packed.

The same goes if I add an URL to a .png file. Instead of downloading the file, it redirects to the homepage where my webhotel is. How can I do this?
Was This Post Helpful? 0
  • +
  • -

#15 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: Write code that allows people to download a file

Posted 03 April 2012 - 10:50 AM

Obviously, the site is designed to require the user to login before getting into the Control Panel. Since that's where your file lives, the user is going to have to login to get to it. If you don't want them to login, put it off of the root domain, like http://unoeuro.com/p...l/recordapp.rar
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2