Hello,
We have some code (see below) that has been working intermittently
and I was wondering if someone had a better approach or an idea on why we
get these errors. This part of code basically gets a file and uploads it
from a cable or DSL connection to our t1 line to a server. The file size
ranges from 1.7 MB to 4MB and there can be between 1-40 files that need to
be uploaded to our server. We also could have multiple laptops running this
application at the same time from different locations. The folder the file
is trying to be stored to has everyone with full permissions. Any help would
be greatly appreciated.
Front end vb app code:
Private Function UploadPhotos(By Val filename As String) As Boolean
Try
Dim f As System.IO.File
Dim fs As System.IO.FileS tream
Dim Service As New host.Service
Dim credentials As System.Net.Netw orkCredential = New
System.Net.Netw orkCredential(" username", "password")
Service.Credent ials = credentials
Service.Url = ServiceUrl
Service.Timeout = 1800000
Dim TstUpload As String
fs = f.Open(UploadDi rectory & filename, IO.FileMode.Ope n,
IO.FileAccess.R ead)
Dim b(CInt(fs.Lengt h) - 1) As Byte
fs.Read(b, 0, CInt(fs.Length) )
Try
TstUpload = Service.UploadF ile(b, filename).ToStr ing
Catch ex As Exception
Msgbox(ex.Stack Trace.ToString)
Return False
End Try
f = Nothing
fs.Close()
Service.Dispose ()
Return True
Catch ex As Exception
Msgbox(ex.Stack Trace.ToString)
Return False
End Try
End Function
Backend Webservice code:
<WebMethod()> Public Function UploadFile(ByVa l fs() As Byte, ByVal FlName As
String) As Boolean
Try
Dim m As New System.IO.Memor yStream(fs)
Dim f As New System.IO.FileS tream("e:\folde r1\folder2\" & FlName,
IO.FileMode.Cre ate)
m.WriteTo(f)
m.Close()
f.Close()
f = Nothing
m = Nothing
Return True
Catch ex As Exception
Return False
End Try
End Function
Some errors:
failed to upload file:db9431.zip the underlying connection was closed: an
unexpected error occurred on a receive. Trace: at
System.Web.Serv ices.Protocols. WebClientProtoc ol.GetWebRespon se(WebRequest
request)
at
System.Web.Serv ices.Protocols. HttpWebClientPr otocol.GetWebRe sponse(WebReque s
t request)
at System.Web.Serv ices.Protocols. SoapHttpClientP rotocol.Invoke( String
methodName, Object[] parameters)
at sync.localhost. Service.UploadF ile(Byte[] fs, String FlName)
at sync.Form1.Uplo adPhotos(String filename)
failed to upload file:db9231.zip the request failed with http status 401:
access denied. Trace: at
System.Web.Serv ices.Protocols. SoapHttpClientP rotocol.ReadRes ponse(SoapClien t
Message message, WebResponse response, Stream responseStream, Boolean
asyncCall)
at System.Web.Serv ices.Protocols. SoapHttpClientP rotocol.Invoke( String
methodName, Object[] parameters)
at sync.localhost. Service.UploadF ile(Byte[] fs, String FlName)
at sync.Form1.Uplo adPhotos(String filename) 15 1709
Hi Jake,
I have changed a sample I had by using a webservice, have a look to it.
In this test I use a XML dataset
I hope this helps?
Cor
\\\needs a picturebox and 4 buttons on a windowform
Dim ds As New DataSet
Private abyt() As Byte
Private fo As New OpenFileDialog
Private sf As New SaveFileDialog
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
'Reading a picture from disk and put it in a bytearray
If fo.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(f o.FileName, _
IO.FileMode.Ope n)
Dim br As New IO.BinaryReader (fs)
abyt = br.ReadBytes(CI nt(fs.Length))
br.Close()
'just to show the sample without a fileread error
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End If
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button2.Click
'writing a picture from a bytearray to disk
If sf.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(s f.FileName, _
IO.FileMode.Cre ateNew)
Dim bw As New IO.BinaryWriter (fs)
bw.Write(abyt)
bw.Close()
End If
End Sub
Private Sub Button3_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button3.Click
'writing a bytearray to a webservice dataset
Dim ws As New localhost.DataB aseUpdate
ws.SetDataset(a byt)
End Sub
Private Sub Button4_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button4.Click
'reading a picture from a webservice dataset
Dim ws As New localhost.DataB aseUpdate
abyt = ws.GetByte
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End Sub
End Class
////
\\\\Webservice
<WebMethod()> _
Public Function GetByte() As Byte()
Dim ds As New DataSet
ds.ReadXml("C:\ wsblob.xml")
Return CType(ds.Tables (0).Rows(0)(0), Byte())
End Function
<WebMethod()> _
Public Sub SetDataset(ByVa l abyte As Byte())
Dim ds As New DataSet
ds.Tables.Add(N ew DataTable("Phot o"))
ds.Tables(0).Co lumns.Add(New DataColumn("Sam ple"))
ds.Tables(0).Co lumns(0).DataTy pe = GetType(System. Byte())
ds.Tables(0).Ro ws.Add(ds.Table s(0).NewRow)
ds.Tables(0).Ro ws(0)(0) = abyte
ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema)
End Sub
////
Hi Jake,
I have changed a sample I had by using a webservice, have a look to it.
In this test I use a XML dataset
I hope this helps?
Cor
\\\needs a picturebox and 4 buttons on a windowform
Dim ds As New DataSet
Private abyt() As Byte
Private fo As New OpenFileDialog
Private sf As New SaveFileDialog
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
'Reading a picture from disk and put it in a bytearray
If fo.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(f o.FileName, _
IO.FileMode.Ope n)
Dim br As New IO.BinaryReader (fs)
abyt = br.ReadBytes(CI nt(fs.Length))
br.Close()
'just to show the sample without a fileread error
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End If
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button2.Click
'writing a picture from a bytearray to disk
If sf.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(s f.FileName, _
IO.FileMode.Cre ateNew)
Dim bw As New IO.BinaryWriter (fs)
bw.Write(abyt)
bw.Close()
End If
End Sub
Private Sub Button3_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button3.Click
'writing a bytearray to a webservice dataset
Dim ws As New localhost.DataB aseUpdate
ws.SetDataset(a byt)
End Sub
Private Sub Button4_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button4.Click
'reading a picture from a webservice dataset
Dim ws As New localhost.DataB aseUpdate
abyt = ws.GetByte
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End Sub
End Class
////
\\\\Webservice
<WebMethod()> _
Public Function GetByte() As Byte()
Dim ds As New DataSet
ds.ReadXml("C:\ wsblob.xml")
Return CType(ds.Tables (0).Rows(0)(0), Byte())
End Function
<WebMethod()> _
Public Sub SetDataset(ByVa l abyte As Byte())
Dim ds As New DataSet
ds.Tables.Add(N ew DataTable("Phot o"))
ds.Tables(0).Co lumns.Add(New DataColumn("Sam ple"))
ds.Tables(0).Co lumns(0).DataTy pe = GetType(System. Byte())
ds.Tables(0).Ro ws.Add(ds.Table s(0).NewRow)
ds.Tables(0).Ro ws(0)(0) = abyte
ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema)
End Sub
////
Hi Cor,
Thanks for the sample. However this sticks the file in a database while
we are actually transferring the physical files themselves. Looking at my
code can you see any issues with why we are getting those errors? Any help
would be greatly appreciated.
Jake
"Cor" <no*@non.com> wrote in message
news:Os******** ******@TK2MSFTN GP11.phx.gbl... Hi Jake,
I have changed a sample I had by using a webservice, have a look to it.
In this test I use a XML dataset
I hope this helps?
Cor
\\\needs a picturebox and 4 buttons on a windowform Dim ds As New DataSet Private abyt() As Byte Private fo As New OpenFileDialog Private sf As New SaveFileDialog
Private Sub Button1_Click(B yVal sender As System.Object, _ ByVal e As System.EventArg s) Handles Button1.Click 'Reading a picture from disk and put it in a bytearray If fo.ShowDialog = DialogResult.OK Then Dim fs As New IO.FileStream(f o.FileName, _ IO.FileMode.Ope n) Dim br As New IO.BinaryReader (fs) abyt = br.ReadBytes(CI nt(fs.Length)) br.Close() 'just to show the sample without a fileread error Dim ms As New IO.MemoryStream (abyt) Me.PictureBox1. Image = Image.FromStrea m(ms) End If End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _ e As System.EventArg s) Handles Button2.Click 'writing a picture from a bytearray to disk If sf.ShowDialog = DialogResult.OK Then Dim fs As New IO.FileStream(s f.FileName, _ IO.FileMode.Cre ateNew) Dim bw As New IO.BinaryWriter (fs) bw.Write(abyt) bw.Close() End If End Sub
Private Sub Button3_Click(B yVal sender As System.Object, ByVal _ e As System.EventArg s) Handles Button3.Click 'writing a bytearray to a webservice dataset Dim ws As New localhost.DataB aseUpdate ws.SetDataset(a byt) End Sub
Private Sub Button4_Click(B yVal sender As System.Object, _ ByVal e As System.EventArg s) Handles Button4.Click 'reading a picture from a webservice dataset Dim ws As New localhost.DataB aseUpdate abyt = ws.GetByte Dim ms As New IO.MemoryStream (abyt) Me.PictureBox1. Image = Image.FromStrea m(ms) End Sub End Class //// \\\\Webservice <WebMethod()> _ Public Function GetByte() As Byte() Dim ds As New DataSet ds.ReadXml("C:\ wsblob.xml") Return CType(ds.Tables (0).Rows(0)(0), Byte()) End Function
<WebMethod()> _ Public Sub SetDataset(ByVa l abyte As Byte()) Dim ds As New DataSet ds.Tables.Add(N ew DataTable("Phot o")) ds.Tables(0).Co lumns.Add(New DataColumn("Sam ple")) ds.Tables(0).Co lumns(0).DataTy pe = GetType(System. Byte()) ds.Tables(0).Ro ws.Add(ds.Table s(0).NewRow) ds.Tables(0).Ro ws(0)(0) = abyte ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema) End Sub ////
Hi Cor,
Thanks for the sample. However this sticks the file in a database while
we are actually transferring the physical files themselves. Looking at my
code can you see any issues with why we are getting those errors? Any help
would be greatly appreciated.
Jake
"Cor" <no*@non.com> wrote in message
news:Os******** ******@TK2MSFTN GP11.phx.gbl... Hi Jake,
I have changed a sample I had by using a webservice, have a look to it.
In this test I use a XML dataset
I hope this helps?
Cor
\\\needs a picturebox and 4 buttons on a windowform Dim ds As New DataSet Private abyt() As Byte Private fo As New OpenFileDialog Private sf As New SaveFileDialog
Private Sub Button1_Click(B yVal sender As System.Object, _ ByVal e As System.EventArg s) Handles Button1.Click 'Reading a picture from disk and put it in a bytearray If fo.ShowDialog = DialogResult.OK Then Dim fs As New IO.FileStream(f o.FileName, _ IO.FileMode.Ope n) Dim br As New IO.BinaryReader (fs) abyt = br.ReadBytes(CI nt(fs.Length)) br.Close() 'just to show the sample without a fileread error Dim ms As New IO.MemoryStream (abyt) Me.PictureBox1. Image = Image.FromStrea m(ms) End If End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _ e As System.EventArg s) Handles Button2.Click 'writing a picture from a bytearray to disk If sf.ShowDialog = DialogResult.OK Then Dim fs As New IO.FileStream(s f.FileName, _ IO.FileMode.Cre ateNew) Dim bw As New IO.BinaryWriter (fs) bw.Write(abyt) bw.Close() End If End Sub
Private Sub Button3_Click(B yVal sender As System.Object, ByVal _ e As System.EventArg s) Handles Button3.Click 'writing a bytearray to a webservice dataset Dim ws As New localhost.DataB aseUpdate ws.SetDataset(a byt) End Sub
Private Sub Button4_Click(B yVal sender As System.Object, _ ByVal e As System.EventArg s) Handles Button4.Click 'reading a picture from a webservice dataset Dim ws As New localhost.DataB aseUpdate abyt = ws.GetByte Dim ms As New IO.MemoryStream (abyt) Me.PictureBox1. Image = Image.FromStrea m(ms) End Sub End Class //// \\\\Webservice <WebMethod()> _ Public Function GetByte() As Byte() Dim ds As New DataSet ds.ReadXml("C:\ wsblob.xml") Return CType(ds.Tables (0).Rows(0)(0), Byte()) End Function
<WebMethod()> _ Public Sub SetDataset(ByVa l abyte As Byte()) Dim ds As New DataSet ds.Tables.Add(N ew DataTable("Phot o")) ds.Tables(0).Co lumns.Add(New DataColumn("Sam ple")) ds.Tables(0).Co lumns(0).DataTy pe = GetType(System. Byte()) ds.Tables(0).Ro ws.Add(ds.Table s(0).NewRow) ds.Tables(0).Ro ws(0)(0) = abyte ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema) End Sub ////
Hi Jake, Thanks for the sample. However this sticks the file in a database
while we are actually transferring the physical files themselves. Looking at my code can you see any issues with why we are getting those errors? Any help would be greatly appreciated.
That dataset was something extra, here I changed it that it does images
direct.
Give it a try?
Cor
\\\
Private abyt() As Byte
Private fo As New OpenFileDialog
Private sf As New SaveFileDialog
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
'Reading a picture from disk and put it in a bytearray
If fo.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(f o.FileName, _
IO.FileMode.Ope n)
Dim br As New IO.BinaryReader (fs)
abyt = br.ReadBytes(CI nt(fs.Length))
br.Close()
'just to show the sample without a fileread error
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End If
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button2.Click
'writing a picture from a bytearray to disk
If sf.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(s f.FileName, _
IO.FileMode.Cre ateNew)
Dim bw As New IO.BinaryWriter (fs)
bw.Write(abyt)
bw.Close()
End If
End Sub
Private Sub Button3_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button3.Click
'writing a bytearray to a webservice file
Dim ws As New localhost.Photo Update
ws.SetFile("C:\ myjpg.jpg", abyt)
End Sub
Private Sub Button4_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button4.Click
'reading a picture from a webservice file
Dim ws As New localhost.Photo Update
abyt = ws.GetFile("c:\ myjpg.jpg")
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End Sub
///
\\\webservice
<WebMethod()> _
Public Function GetFile(ByVal myjpg As String) As Byte()
Dim abyt() As Byte
Dim fs As New IO.FileStream(m yjpg, _
IO.FileMode.Ope n)
Dim br As New IO.BinaryReader (fs)
abyt = br.ReadBytes(CI nt(fs.Length))
br.Close()
Return abyt
End Function
<WebMethod()> _
Public Sub SetFile(ByVal myjpg As String, ByVal abyt As Byte())
Dim fs As New IO.FileStream(m yjpg, _
IO.FileMode.Cre ateNew)
Dim bw As New IO.BinaryWriter (fs)
bw.Write(abyt)
bw.Close()
End Sub
////
Hi Jake, Thanks for the sample. However this sticks the file in a database
while we are actually transferring the physical files themselves. Looking at my code can you see any issues with why we are getting those errors? Any help would be greatly appreciated.
That dataset was something extra, here I changed it that it does images
direct.
Give it a try?
Cor
\\\
Private abyt() As Byte
Private fo As New OpenFileDialog
Private sf As New SaveFileDialog
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
'Reading a picture from disk and put it in a bytearray
If fo.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(f o.FileName, _
IO.FileMode.Ope n)
Dim br As New IO.BinaryReader (fs)
abyt = br.ReadBytes(CI nt(fs.Length))
br.Close()
'just to show the sample without a fileread error
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End If
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button2.Click
'writing a picture from a bytearray to disk
If sf.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(s f.FileName, _
IO.FileMode.Cre ateNew)
Dim bw As New IO.BinaryWriter (fs)
bw.Write(abyt)
bw.Close()
End If
End Sub
Private Sub Button3_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button3.Click
'writing a bytearray to a webservice file
Dim ws As New localhost.Photo Update
ws.SetFile("C:\ myjpg.jpg", abyt)
End Sub
Private Sub Button4_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button4.Click
'reading a picture from a webservice file
Dim ws As New localhost.Photo Update
abyt = ws.GetFile("c:\ myjpg.jpg")
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End Sub
///
\\\webservice
<WebMethod()> _
Public Function GetFile(ByVal myjpg As String) As Byte()
Dim abyt() As Byte
Dim fs As New IO.FileStream(m yjpg, _
IO.FileMode.Ope n)
Dim br As New IO.BinaryReader (fs)
abyt = br.ReadBytes(CI nt(fs.Length))
br.Close()
Return abyt
End Function
<WebMethod()> _
Public Sub SetFile(ByVal myjpg As String, ByVal abyt As Byte())
Dim fs As New IO.FileStream(m yjpg, _
IO.FileMode.Cre ateNew)
Dim bw As New IO.BinaryWriter (fs)
bw.Write(abyt)
bw.Close()
End Sub
////
Cor,
Thanks for the code sample. Can you explain what the major difference
would be between my webserivce and yours? It seems that yours is opening the
file and passing it that way, while mine is converts the file to a byte and
then passes it as well. Any ideas on why we get this error(see below)
//application
Private Function UploadPhotos(By Val filename As String) As Boolean
Try
Dim f As System.IO.File
Dim fs As System.IO.FileS tream
Dim Service As New localhost.VCRSe rvice273
Dim credentials As System.Net.Netw orkCredential = New
System.Net.Netw orkCredential(" USER", "Password")
Service.Credent ials = credentials
Service.Url = ServiceUrl
Service.Timeout = 3600000
Dim TstUpload As String
fs = f.Open(UploadDi rectory & filename, IO.FileMode.Ope n,
IO.FileAccess.R ead)
Dim b(CInt(fs.Lengt h) - 1) As Byte
fs.Read(b, 0, CInt(fs.Length) )
Try
TstUpload = Service.UploadF ile(b, filename).ToStr ing
Catch ex As Exception
Return False
End Try
f = Nothing
fs.Close()
Service.Dispose ()
Return True
Catch ex As Exception
Return False
End Try
end sub
//
<WebMethod()> Public Function UploadFile(ByVa l fs() As Byte, ByVal
FlName As String) As Boolean
Try
Dim m As New System.IO.Memor yStream(fs)
Dim f As New System.IO.FileS tream("e:\websi te\vcnservice\" &
FlName, IO.FileMode.Cre ate)
m.WriteTo(f)
m.Close()
f.Close()
f = Nothing
m = Nothing
Return True
Catch ex As Exception
Return False
End Try
common error:
Failed to upload file:db9913.zip the request failed with http status 401:
access denied. Trace: at
system.Web.Serv ices.Protocols. SoapHttpClientP rotocol.ReadRes ponse(SoapClien t
Message message, WebResponse response, Stream responseStream, Boolean
asyncCall)
at System.Web.Serv ices.Protocols. SoapHttpClientP rotocol.Invoke( String
methodName, Object[] parameters)
at application.loc alhost.Service. UploadFile(Byte[] fs, String FlName)
at application.For m1.UploadPhotos (String filename)
//Your sample
//application
//webservice
<WebMethod()> _
Public Function GetFile(ByVal myjpg As String) As Byte()
Dim abyt() As Byte
Dim fs As New IO.FileStream(m yjpg _
IO.FileMode.Ope n)
Dim br As New IO.BinaryReader (fs)
abyt = br.ReadBytes(CI nt(fs.Length))
br.Close()
Return abyt
End Function
"Cor" <no*@non.com> wrote in message
news:eo******** ********@TK2MSF TNGP11.phx.gbl. .. Hi Jake,
Thanks for the sample. However this sticks the file in a database
while we are actually transferring the physical files themselves. Looking at
my code can you see any issues with why we are getting those errors? Any
help would be greatly appreciated.
That dataset was something extra, here I changed it that it does images direct.
Give it a try?
Cor
\\\ Private abyt() As Byte Private fo As New OpenFileDialog Private sf As New SaveFileDialog Private Sub Button1_Click(B yVal sender As System.Object, _ ByVal e As System.EventArg s) Handles Button1.Click 'Reading a picture from disk and put it in a bytearray If fo.ShowDialog = DialogResult.OK Then Dim fs As New IO.FileStream(f o.FileName, _ IO.FileMode.Ope n) Dim br As New IO.BinaryReader (fs) abyt = br.ReadBytes(CI nt(fs.Length)) br.Close() 'just to show the sample without a fileread error Dim ms As New IO.MemoryStream (abyt) Me.PictureBox1. Image = Image.FromStrea m(ms) End If End Sub Private Sub Button2_Click(B yVal sender As System.Object, ByVal _ e As System.EventArg s) Handles Button2.Click 'writing a picture from a bytearray to disk If sf.ShowDialog = DialogResult.OK Then Dim fs As New IO.FileStream(s f.FileName, _ IO.FileMode.Cre ateNew) Dim bw As New IO.BinaryWriter (fs) bw.Write(abyt) bw.Close() End If End Sub Private Sub Button3_Click(B yVal sender As System.Object, ByVal _ e As System.EventArg s) Handles Button3.Click 'writing a bytearray to a webservice file Dim ws As New localhost.Photo Update ws.SetFile("C:\ myjpg.jpg", abyt) End Sub Private Sub Button4_Click(B yVal sender As System.Object, _ ByVal e As System.EventArg s) Handles Button4.Click 'reading a picture from a webservice file Dim ws As New localhost.Photo Update abyt = ws.GetFile("c:\ myjpg.jpg") Dim ms As New IO.MemoryStream (abyt) Me.PictureBox1. Image = Image.FromStrea m(ms) End Sub /// \\\webservice <WebMethod()> _ Public Function GetFile(ByVal myjpg As String) As Byte() Dim abyt() As Byte Dim fs As New IO.FileStream(m yjpg, _ IO.FileMode.Ope n) Dim br As New IO.BinaryReader (fs) abyt = br.ReadBytes(CI nt(fs.Length)) br.Close() Return abyt End Function <WebMethod()> _ Public Sub SetFile(ByVal myjpg As String, ByVal abyt As Byte()) Dim fs As New IO.FileStream(m yjpg, _ IO.FileMode.Cre ateNew) Dim bw As New IO.BinaryWriter (fs) bw.Write(abyt) bw.Close() End Sub ////
Hi Jake,
That 401 is in my opinion a logon code, can you before I check your code
first make with all the things in it to logon a simple "Hello World"
application to see if all the connections and credentials are right, than I
will try to simulate your code tomorrow OK?
Cor
Cor,
Thanks Cor I appreciate it. Some info on the overall app. The function
prior to this one reads a directory of files (all jpgs) and then grabs 2 MB
worth and then moves them to an uptemp folder. Once this process is done
there is between 2 and 30 zip files. The app then reads the uptemp directory
and calls the uploadPhoto service to transfer the files to our server. The
login and password are valid. We have about 50 people using the app. I can
goto a browser and get to the url putting in the login and password. A
simple hello world does work. As for the code I got it pretty much from the
following url http://www.dotnetextreme.com/code/binaryupload.asp So I am
confused on why some people get it(all running the same version of the app
with the same code and all are on W2k mobile tablets). It's not specific to
any person and I do not see a pattern forming, it seems to be a random
thing.
John
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:ui******** ******@TK2MSFTN GP11.phx.gbl... Hi Jake,
That 401 is in my opinion a logon code, can you before I check your code first make with all the things in it to logon a simple "Hello World" application to see if all the connections and credentials are right, than
I will try to simulate your code tomorrow OK?
Cor
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ray |
last post by:
Hello,
This one I think should be easy when you now how but I couldn't get it
today.
I have to run a kind of double check routine.
1 database, 2 tables. No linking or referential integrity or any of that.
TableA has 2 fields that matter - ....
TableB is exactly the same - ....
|
by: Tom Gugger |
last post by:
OMNI GROUP
tgugger@buckeye-express.com
419-380-8853
BEA MIDDLEWARE EXPERT/ CONTRACT TO PERM/ PA
|
by: John Smith |
last post by:
Hi All,
Sorry if I am calling expert's advice on such a simple thing. I am reading
a c++ code but do not understand what this means?
#define DM_ITEMS 6
#define FM_ITEMS ( 1 << (DM_ITEMS - 1) )
when I look at the value of FM_ITEMS in my debug log it is 32.
|
by: ViperDK \(Daniel K.\) |
last post by:
i've a database where relations are hold in a special way which the project
leaders think of as "performant and uncomplicated" but which is very
questionable to me:
------------------------------------------------
Table
Fields and
Table
Fields object stuff.... and (varchar with 0-20 ids usually)
|
by: Holli Graham |
last post by:
Hi,
Could some Opera CSS expert take a look at http://www.cahabagba.com
and tell me if there is a problem with my stylesheets or if it's just
Opera weirdness? I've tested this on many browsers and seem to get
acceptable results on all of them (using browsercam). However, when I
use Opera 6.04 on Windows 2000 on my system, the bottom footer
sometimes overlaps the main content. What is so weird is that if the
footer is below the fold...
| |
by: Tony Houghton |
last post by:
Can anyone recommend a good book for intermediate up to expert level?
I'm an experienced C programmer and I learnt Python from the "Learning
Python" O'Reilly book because it had good reviews. I was disappointed
though. It was difficult to read because it was so verbose. It would
sometimes take more than a page to explain something where all the
information I needed could have been conveyed in one sentence. If
anyone's seen Leendert...
|
by: Wendell III |
last post by:
Meetroduction (Meetro) is looking for a full-time JavaScript expert.
Chicago-based startup seeks an experienced, dedicated and energetic
JavaScript programmer to develop components of a robust, browser-hosted
social networking application. You must have very strong AJAX-Object
Oriented JavaScript skills, intimate knowledge of the DOM and
experience developing XML driven applications using JavaScript. This
position requires excellent...
|
by: E.T. Grey |
last post by:
Hi,
I have a C++ DLL that I want to use from a C# project. I am actually
usng a lot of advanced C++ features like templates, partial/specialized
templates, functors and callbacks. I am also using STL containers like
std::string, std::vector and std::map quite extensively in my C++ DLL API.
However, I can simplify the API so as to make it easier to use from C#.
Below, is a very simple "proof of concept" C++ DLL. I would be extremely...
|
by: jesper_lofgren |
last post by:
Hi there,
I have some webcontrols that i want to add dynamically on a page. I
have stored the path / namespace in database (ex
MyNameSpace.WebControls.Control1) to the class/webcontrol.
Lets say i have a column in database that looks like this.
PageID (int) Webcontrol (varchar)
1 MyNameSpace.WebControls.Control1
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |