Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2005

Tip: Looking for answers? Try searching our database.

Download binary data from WebService

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nikolay Petrov - 03 Mar 2005 15:58 GMT
Any general ideas how to get binary data(files) from WebService to an
ASP .NET app and then save it to client's machine?

Thanks
Cor Ligthert - 03 Mar 2005 16:22 GMT
Nikolay,

You have first to serialize them.

A sample from Tom that I find nice

\\\Tom Shelton
Private Function SerializeFontObject(ByVal fnt As Font) As String
       Dim bf As New BinaryFormatter
       Dim mem As New MemoryStream
       Try
           bf.Serialize(mem, fnt)
           Return Convert.ToBase64String(mem.ToArray())
       Catch
           Return String.Empty
       Finally
           mem.Close()
       End Try
End Function
Private Function DeserializeFontObject(ByVal fnt As String) As Font
       Dim bf As New BinaryFormatter
       Dim mem As New MemoryStream(Convert.FromBase64String(fnt))
       Try
           Return DirectCast(bf.Deserialize(mem), Font)
       Finally
           If Not mem Is Nothing Then
               mem.Close()
           End If
       End Try
End Function

I hope this helps a little bit?

Cor
Nikolay Petrov - 03 Mar 2005 17:17 GMT
I know I can also use DIME attachments, so I don't need to convert the
data to Base64.

my question was not very exact .

I am looking in to way of sending big files (over 10MB). The way of
using DIME attachements is good for this, because i can split the files
to parts, not send them as one piece. I've used the for upload and it
works great.

The problem is that I can't figure out how to ask the web service for
the first part, then second and so on.

when uploading to web service i do a FOR loop and send chunks if data
to service, which concantenates them in file, but how to make the
service reads parts of the file and send them is unclear to me.

the reason i want to split the transfered files to parts is that it
will consume a lot of memory at the server if I read the whole file,
serialize it and then start sending it.
Cor Ligthert - 03 Mar 2005 17:28 GMT
Nikolay,

I thought I answered this question already like this, however when not.

Why don't you just download them with webclient downloadfile, where you get
the url from the webservice

I hope this helps?

Cor
Nikolay Petrov - 03 Mar 2005 18:09 GMT
this will also work i guess

tnx.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.