J
Jake
Hello,
I need some help and if anyone can figure this out I will bow to
him/her. We have a vb.net app that is trying to transfer files from a
client's w2k tablet pc to our server. The app is deployed on more than 60
clients. For some of the clients they get a 401 error when running this part
of the program that uploads the files. There are about 3 clients that
constantly get the error and about 5 that get it randomly, the other 52
people do not have a problem. Each client has different ISP's, run the
application at different times, basically there isn't a common factor I can
see between them. I would greatly appreciate any help someone can give me.
Below is the code.
vb.net app
function uploadphotos
Try
Dim f As System.IO.File
Dim fs As System.IO.FileStream
Dim Service As New localhost.vcrservice300
Dim credentials As System.Net.NetworkCredential = New
System.Net.NetworkCredential("USER", "PASS")
Service.Credentials = credentials
Service.Url = ServiceUrl
Service.Timeout = 3600000
Dim TstUpload As String
fs = f.Open(UploadDirectory & filename, IO.FileMode.Open,
IO.FileAccess.Read)
Dim b(CInt(fs.Length) - 1) As Byte
fs.Read(b, 0, CInt(fs.Length))
Try
TstUpload = Service.UploadFile(b, filename).ToString
Catch ex As Exception
SendErrorToDB("HH3 Name: " & HH3Name & ": Failed to upload file:" & filename
& " " & ex.Message, "79", " Trace: " & ex.StackTrace.ToString)
****exception thrown here****
Return False
End Try
f = Nothing
fs.Close()
Service.Dispose()
Return True
Catch ex As Exception
SendErrorToDB("HH3 Name: " & HH3Name & ": Failed to upload file:" &
filename, "80", " Trace: " & ex.StackTrace.ToString)
Return False
End Try
webservice---this code is pretty much the standard I have seen on the net.
i.e. codeproject.com
<WebMethod()> Public Function UploadFile(ByVal fs() As Byte, ByVal FlName As
String) As Boolean
Try
Dim m As New System.IO.MemoryStream(fs)
Dim f As New System.IO.FileStream("e:\files\" & FlName, IO.FileMode.Create)
m.WriteTo(f)
m.Close()
f.Close()
f = Nothing
m = Nothing
Return True
Catch ex As Exception
Return False
End Try
End Function
The 401 gets thrown if we have anonymous set to either on/off in IIS 6. I
have checked with our ISP and our T1 is not being maxed out.
Client w2k
Server w2k3
I need some help and if anyone can figure this out I will bow to
him/her. We have a vb.net app that is trying to transfer files from a
client's w2k tablet pc to our server. The app is deployed on more than 60
clients. For some of the clients they get a 401 error when running this part
of the program that uploads the files. There are about 3 clients that
constantly get the error and about 5 that get it randomly, the other 52
people do not have a problem. Each client has different ISP's, run the
application at different times, basically there isn't a common factor I can
see between them. I would greatly appreciate any help someone can give me.
Below is the code.
vb.net app
function uploadphotos
Try
Dim f As System.IO.File
Dim fs As System.IO.FileStream
Dim Service As New localhost.vcrservice300
Dim credentials As System.Net.NetworkCredential = New
System.Net.NetworkCredential("USER", "PASS")
Service.Credentials = credentials
Service.Url = ServiceUrl
Service.Timeout = 3600000
Dim TstUpload As String
fs = f.Open(UploadDirectory & filename, IO.FileMode.Open,
IO.FileAccess.Read)
Dim b(CInt(fs.Length) - 1) As Byte
fs.Read(b, 0, CInt(fs.Length))
Try
TstUpload = Service.UploadFile(b, filename).ToString
Catch ex As Exception
SendErrorToDB("HH3 Name: " & HH3Name & ": Failed to upload file:" & filename
& " " & ex.Message, "79", " Trace: " & ex.StackTrace.ToString)
****exception thrown here****
Return False
End Try
f = Nothing
fs.Close()
Service.Dispose()
Return True
Catch ex As Exception
SendErrorToDB("HH3 Name: " & HH3Name & ": Failed to upload file:" &
filename, "80", " Trace: " & ex.StackTrace.ToString)
Return False
End Try
webservice---this code is pretty much the standard I have seen on the net.
i.e. codeproject.com
<WebMethod()> Public Function UploadFile(ByVal fs() As Byte, ByVal FlName As
String) As Boolean
Try
Dim m As New System.IO.MemoryStream(fs)
Dim f As New System.IO.FileStream("e:\files\" & FlName, IO.FileMode.Create)
m.WriteTo(f)
m.Close()
f.Close()
f = Nothing
m = Nothing
Return True
Catch ex As Exception
Return False
End Try
End Function
The 401 gets thrown if we have anonymous set to either on/off in IIS 6. I
have checked with our ISP and our T1 is not being maxed out.
Client w2k
Server w2k3