[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to resolve timeout problem on Net.WebClient.UploadData?

Posted on 2004-03-25
8
Medium Priority
?
7,757 Views
Last Modified: 2007-11-27
Hai all,

I have a program which uploads 100k to 100mb files... It's working fine if the connection is LAN or > 56kbps line. When i try to upload 180k file using 36Kbps Dialup modem it fails to upload and says "time-out"... I searched on net for solution but no joys... I've seen a comment that this in ongoing problem right from VB6... Can somebody suggest me some way of overcome this problem... The code is running on VB.NET using the namespace Net.WebClient.UploadData. I've tried Net.WebClient.Uploadfile "PUT" method, but the files are getting corrupted on remote server as PUT method has some restrictions on upload size... I've tried "POST" method too but unfortunately my server does not support this method....

I'm trying HttpWebRequest to upload files... I'm not sure that this might solve my problems.... does any body having experience using HttpWebRequest to upload min of 20mb file using dialup connection?

PS :- My remote system is running 2000 server with IIS (does'nt have .NET in it).

Any code sample would help to move forward.
Thanks in advance.
Ajai Kumar .R
0
Comment
Question by:ajaikumarr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 6

Expert Comment

by:dash420
ID: 10676157
use
  Server.ScriptTimeout = <x> like Server.ScriptTimeout = 1000000 in the code behind file.

where x in second,
0
 
LVL 11

Author Comment

by:ajaikumarr
ID: 10685289
Hai Dash420,

>>The code is running on VB.NET using the namespace Net.WebClient.UploadData.<<
I'm writing it on VB.NET.

>>PS :- My remote system is running 2000 server with IIS (does'nt have .NET in it).<<
I dont have .NET installed on my server. so i can't use codebehind or server.scripttimeout....

Bye
Ajai
0
 
LVL 6

Expert Comment

by:dash420
ID: 10685351
Ok,
Open inetmgr, right click on the vertual folder. Click on directory tab. Then click on the configuartion button. Then click on the App Options. You find Asp Script time out in second. default is 90 sec. Increase it to required second.


0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 11

Accepted Solution

by:
ajaikumarr earned 0 total points
ID: 10711935
Hai dash420,

I've solved my problem using the below code... Any how thanks.

Dim UploadRequest As System.Net.HttpWebRequest = CType(System.Net.WebRequest.Create(New Uri(TargetFile)), System.Net.HttpWebRequest)
UploadRequest.Timeout = nnnnnn (Required timeout milliseconds)
UploadRequest.Method = "PUT"
UploadRequest.ContentLength = New System.IO.FileInfo(SourceFile).Length

Dim SourceStream As New System.IO.FileStream(SourceFile, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite)
Dim RequestStream As System.IO.Stream = UploadRequest.GetRequestStream()
Dim Buffer(4095) As Byte
Dim Position As Integer = 0, ivlLoop As Integer = 0
Position = SourceStream.Read(Buffer, 0, Buffer.Length)
While Position <> 0
  RequestStream.Write(Buffer, 0, Position)
  Position = SourceStream.Read(Buffer, 0, Buffer.Length)
End While

Dim WebResponse As System.Net.HttpWebResponse = CType(UploadRequest.GetResponse(), System.Net.HttpWebResponse)
Dim ResponseReader As New System.IO.StreamReader(WebResponse.GetResponseStream())
Response = ResponseReader.ReadToEnd()

RequestStream.Close()
UploadRequest = Nothing

Bye
Ajai Kumar .R
0
 
LVL 1

Expert Comment

by:kapcreations
ID: 11008930
ajaikumarr,

can you post the completed working code both for this application, as well as the receiving .aspx page?  I have a similar problem as can not seem to get past it.

TIA

kap
0
 
LVL 11

Author Comment

by:ajaikumarr
ID: 11020448
Hai Kapcreations,

I did this on VB.NET... If you think it would help you i can post it...

Bye
Ajai
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question