473,499 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebException was unhandled - Execution has timed-out

3 New Member
hi friends,
I'm developing a device application, wherein i'm supposed to upload a file from the device to the virtual directory of the local machine/across the network.
Below is code i used. i'm getting the error message "Execution has timed-out" at the line -------req.GetResponse()------


//Code


public void UploadFile(string localFile, string uploadUrl)
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uploadUrl);
req.Method = "PUT";
req.AllowWriteStreamBuffering = true;
// req.Timeout = -1;


// Retrieve request stream and wrap in StreamWriter
Stream reqStream = req.GetRequestStream();
StreamWriter wrtr = new StreamWriter(reqStream);

// Open the local file
StreamReader rdr = new StreamReader(localFile);

// loop through the local file reading each line
// and writing to the request stream buffer
string inLine = rdr.ReadLine();
while (inLine != null)
{
wrtr.WriteLine(inLine);
inLine = rdr.ReadLine();
}

rdr.Close();

wrtr.Close();

req.GetResponse();

}


Please suggest your issues on the same.
Thanks.
May 29 '07 #1
0 1172

Sign in to post your reply or Sign up for a free account.

Similar topics

2
16092
by: genc_ ymeri at hotmail dot com | last post by:
Hi, I'm trying to recieve the response status code rather than the message in the below code : try { responseArray = myWebClient.UploadValues(uriString,"POST",myNameValueCollection); }...
2
1617
by: Javaman59 | last post by:
I have a GUI which is monitoring a real-time device. I have several timed actions, such as periodic polling of the device, and indicators which flash for a fixed period. My first implementation...
3
3962
by: A User | last post by:
Very strange - this code is copy and paste from the net and works on 2 of my 3 development machines - but of course not the machine I need to run it on. I've seen similar posts, but no solutions...
3
1786
by: Anonymous | last post by:
What can cause this error from the following code? An unhandled exception of type 'System.Net.WebException' occurred in system.dll Additional information: The underlying connection was closed:...
40
2930
by: kavi | last post by:
Hello friends, Could any one tell the way of calculating the speed of c program execution?
2
2168
by: Bob | last post by:
I MUST be able to trap unhandled exceptions, bring the thread to a routine that then closes the thread on which the execption occurred without closing or affecting the other threads. Think of an...
1
8715
by: roadie.girl | last post by:
Hey guys - I'm really new to this .NET programming so please bear with me ... (vb.NET) I'm trying to fill in the list contents of a combo box on the open event of a form. this list will list...
0
848
by: Robert Dufour | last post by:
I have some things I need done in the application events unhandledexception event. I have some code in there whose execution I need to verify. In order to do that I wrote a simple button click...
4
2112
by: =?Utf-8?B?UGhpbGlwIEs=?= | last post by:
Simplifying the code a bit its like this: try { myRemotingObj.Myfunction(string, string,string,string,timeSpan) } catch(WebException) { commsUp = false; }
3
1889
sid0404
by: sid0404 | last post by:
Hi I am new to the programming in c#, I have an application where I need to get data from a website now I am getting an error message if I give the input as two strings, say Sun Microsystems while...
0
7007
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...
0
7171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7386
tracyyun
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...
0
5468
agi2029
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,...
0
4599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3098
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3090
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
664
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
295
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.