How to transfer files via FTP under .net?

L

Lacka

Hi,

How can I transfer files via FTP under asp.net? Don't found any info...

thanks,
Lacka
 
K

Kevin Spencer

Hi Lacka,

Be warned: FTP is a notoriously unreliable protocol, and the examples you
will see are only the bare bones of what you will need to create a robust
FTP client. You will have to handle almost every conceivable type of FTP
transfer error that there is, and there are quite a few.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
L

Lacka

Hi Kevin,

I don't want to write an FTP client - I just want to upload a file to
somewhere. Like sending a mail - uploading a file. When unsuccessful, I need
to log the error (just "upload unsuccessful"), and don't want to do further
tasks. Therefore looking for a simple FTP uploader solution, that can use
under asp.net - say from a webservice.
 
K

Kevin Spencer

I don't want to write an FTP client - I just want to upload a file to
somewhere. Like sending a mail - uploading a file. When unsuccessful, I
need
to log the error (just "upload unsuccessful"), and don't want to do
further
tasks. Therefore looking for a simple FTP uploader solution, that can use
under asp.net - say from a webservice.

Uploading a file somewher via FTP, means you need to write an FTP client.
There are only 2 entities in an FTP session: Client and server. Which one
are you planning to write? Hint: The answer is "FTP client."

Now, if you write an FTP client that connects to an FTP server, and attempts
to upload a file, pay attention to my warnings! There is no such thing as "a
simple FTP uploader (read 'client') solution." The basic protocol is about
as simple as they get. Handling dropped packets and other FTP issues is not.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
L

Lacka

Ok, understand.

I have downloaded some components from gotdotnet (thanks for Ken), but I
don't know what to do then? Can you or anybody explain, where to copy the
files of the downloaded component, and how to use it in an aspx file? I
never installed .net components yet, so for me don't say nothing the
filename *.vb, *.sln, *.suo, *.vbproj, etc... Some exaples are on the
gotdotnet site, but no words about installation. I use WebMatrix to create
the aspx files.

Here are the list of files downloaded:

Component #1
---------------
AssemblyInfo.vb
clsFTP.vb
FTP.sln
FTP.suo
FTP.vbproj
FTP.vbproj.user
bin\FTP.dll
FTP.pdb


Component #2
---------------
AssemblyInfo.cs
FtpConnection.cs
FtpException.cs
FtpStream.cs
FtpSupport.csproj
FtpSupport.csproj.user
FtpSupport.sln
FtpSupport.suo
NativeMethods.cs

thanks
 
K

Kevin Spencer

Hi Lacka,

WebMatrix, eh? Well, I'm out. You're going to have to create a scripted
class using Web Matrix, and I have never used it, or scripted classes. I'm a
VS.Net guy. Love them DLLs.

Another alternative would be to shell out a few bucks for a commercial .Net
FTP client. There are several at least out there in Google-Land.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
A

AlexL [Xceed]

I feel that our FTP Library is the best designed on the market. It
even supports Secure FTP.

You'll be sending/receiving files with only one line of code.

http://www.xceedsoft.com/products/FtpNet

And for the same price as other commercial FTP libraries, at Xceed you
get the entire Data Manipulation suite (includes the bestselling Xceed
Zip for .NET, for example).

Hi Lacka,

WebMatrix, eh? Well, I'm out. You're going to have to create a scripted
class using Web Matrix, and I have never used it, or scripted classes. I'm a
VS.Net guy. Love them DLLs.

Another alternative would be to shell out a few bucks for a commercial .Net
FTP client. There are several at least out there in Google-Land.

--
Alex Leblanc
Xceed Software Inc.
http://www.xceedsoft.com

Check out our advanced .NET grid and SmartUI controls

Email: (e-mail address removed) (remove the first 'x')
 
K

Kevin Spencer

Your products are priced nicely too (and no, I never have worked for XCeed).

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
J

Juan T. Llibre

The only comment I have about that is that they're
probably "priced nicely" for the US market.

For many 2nd and 3rd world markets,
their price is prohibitive, and will encourage pirating.

It has been my long-standing viewpoint that software producers
in more-developed countries ( like the US, UK, Australia, Spain,
etc. ) should have lower pricing scales for less-developed markets.

Not scaling down prices so that developers in less-developed
countries which can't compete economically, because their
countris have less-devoped economies, only leads to more
pirating of software useful for developers.

I don't see a reason to peg high prices on software
which is bought by less-developed countries.

At the, comparatively, high prices which are normal for
more-developed countries, the market is close to nil
in less-developed countries.

Making developer software accessible at lower prices in
less-developed countries doesn't equate to a revenue loss
for the companies who make developer software.

It only serves as a stimulus for more revenue when
the economies of those countries upscales.

Setting lower prices for software shipped to less-developed
countries will actually increase revenue for software developers.




Juan T. Llibre
ASP.NET MVP
===========
 
A

AlexL [Xceed]

Interesting. I suppose it is conceivable to show different pricing for
products (as well as different currency) depending on the country of
origin of the visitor to a web site. I'd wager it is being done
already. It would have to be done carefully, though, so as not to
complicate things for sales staff. Example... When asked about pricing
by telephone, one would have to make sure to know the country of
origin first.

The only comment I have about that is that they're
probably "priced nicely" for the US market.

For many 2nd and 3rd world markets,
their price is prohibitive, and will encourage pirating.

It has been my long-standing viewpoint that software producers
in more-developed countries ( like the US, UK, Australia, Spain,
etc. ) should have lower pricing scales for less-developed markets.

Not scaling down prices so that developers in less-developed
countries which can't compete economically, because their
countris have less-devoped economies, only leads to more
pirating of software useful for developers.

I don't see a reason to peg high prices on software
which is bought by less-developed countries.

At the, comparatively, high prices which are normal for
more-developed countries, the market is close to nil
in less-developed countries.

Making developer software accessible at lower prices in
less-developed countries doesn't equate to a revenue loss
for the companies who make developer software.

It only serves as a stimulus for more revenue when
the economies of those countries upscales.

Setting lower prices for software shipped to less-developed
countries will actually increase revenue for software developers.




Juan T. Llibre
ASP.NET MVP
===========

--
Alex Leblanc
Xceed Software Inc.
http://www.xceedsoft.com

Check out our advanced .NET grid and SmartUI controls

Email: (e-mail address removed) (remove the first 'x')
 
R

rpress

I too am looking for an FTP solution for asp.net, I do not wish to
purchase a third party solution. I cannot use HTTPfilkeTransfer as the
files may be 2 Gigs or more in size, would consume too much memory.

The sample page is down, are those examples anywhere else? Does anyone
know of an alternative to FTP for uploading very large files from an
asp.net page?

Thanks

Bob
 
K

Kevin Spencer

The sample page is down, are those examples anywhere else? Does anyone
know of an alternative to FTP for uploading very large files from an
asp.net page?

HTTP? It's much more reliable, and if you plan on writing your own FTP
client, you're in for a lot of trouble. FTP is very unreliable, and prone to
errors. You have to handle them all.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
R

rpress

HTTP would be fine if not for the file size limitations - Microsoft
says:Theoretically, the maximum file upload size is fairly large.
However, because of ASP.NET health monitoring, you cannot upload very
large files in ASP.NET. The ASP.NET worker process has a virtual address
space of 2 gigabytes (GB). However, the ASP.NET worker process only uses
a little more than 1 GB because of health monitoring and memory
fragmentation.

During the upload process, ASP.NET loads the whole file in memory before
the user can save the file to the disk. Therefore, the process may
recycle because of the memoryLimit attribute of the processModel tag in
the Machine.config file. The memoryLimit attribute specifies the
percentage of physical memory that the ASP.NET worker process can
exhaust before the process is automatically recycled. Recycling prevents
memory leaks from causing ASP.NET to crash or to stop responding.

Additionally, other factors play a role in the maximum file size that
can be uploaded. These factors include available memory, available hard
disk space, processor speed, and current network traffic. With regular
traffic of files being uploaded, Microsoft recommends that you use a
maximum file size in the range of 10 to 20 megabytes (MB). If you rarely
upload files, the maximum file size may be 100 MB.
 
G

Guest

Hmm... did you say Web Service?? Why not send the file as MTOM attachment -
using a byte array? If the client that consumes the web service is a smart
client / winform application it would be a quick and fit solution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top