Upload or Download Large Binary Data
Problem
You want to transfer an image or a file to or from a Web service.
Solution
Submit or return the data as a byte array.
Discussion
Web services support only a carefully limited set of data types, an approach that’s designed to ensure optimum cross-platform compatibility. However, you can transmit virtually anything if you convert it to binary first.
The following Web service accepts a byte array and saves it directly to disk. For this code to work, the ASP.NET process must have privileges to write to the appropriate directory. You should also import the System.IO namespace.
<WebService()> _ Public Class UploadData Inherits System.Web.Services.WebService <WebMethod()> _ Public Sub UploadFile(ByVal originalName ...
Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.