473,320 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

HttpWebRequest Timout Error Problem

I am having trouble with the HttpWebRequest.GetRequestStream method.

I am posting data to my web server running NT4 iis4 using a loop. So
every time the loop executes I want it to post data to my web page.
It work the first 2 times the loop iterates, but on the third time
around it gives me a timout error.

The line it gives me an error on is:
--Stream newStream = myRequest.GetRequestStream();--

Could someone please point me in the right direction.

Many thanks!
Form Code:
private void button1_Click(object sender, System.EventArgs e)
{
int x;
x=0;
while(x < 1)
{
this.textBox1.Text = "Sleeping";
Application.DoEvents();
Thread.Sleep(3000);

HRATS_Functions X = new HRATS_Functions();

try
{
X.PostData();
X.Dispose();
//this.textBox2.Text = X.myResponse.ToString();
}
catch (Exception a)
{
this.textBox1.Text = "Exception: " + a.ToString();
break;
}

this.textBox1.Text = "Awake";
Application.DoEvents();
Thread.Sleep(3000);
}
}
Class Code:
public HttpWebRequest myRequest =
(HttpWebRequest)Request.Create("http://lab/collectdata.asp");
public ASCIIEncoding encoding = new ASCIIEncoding();
public string myResponse;

public void PostData()
{
// Initialize the WebRequest parameters
string postData = "First_Name=Matt";
byte[] byte1 = encoding.GetBytes(postData);

//Set Request Properties
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = postData.Length;
myRequest.Timeout = 5000;

//send the request
Stream newStream = myRequest.GetRequestStream();
newStream.Write(byte1,0,byte1.Length);
newStream.Flush();
newStream.Close();
}
Jul 22 '05 #1
2 2519
"Matt" <sa*******@yahoo.com> wrote...
I am having trouble with the HttpWebRequest.GetRequestStream method.

I am posting data to my web server running NT4 iis4 using a loop. So
every time the loop executes I want it to post data to my web page.
It work the first 2 times the loop iterates, but on the third time
around it gives me a timout error.
[...]


This has nothing to do with the language. Please post to a forum
where 'HttpWebRequest' is on topic, I think you should find more help
in comp.os.ms-windows.programmer.win32.
Jul 22 '05 #2

Could someone please point me in the right direction.


Have a look at the following groups:
microsoft.public.dotnet.framework
microsoft.public.dotnet.framework.webservices

For a full listing of the MS groups conserning the
dotnet framework, have a look here:
http://groups.google.com/groups?hl=e...tnet.framework
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Satinderpal Singh | last post by:
Hi everyone, We are using HttpWebRequest to create a request to a URI, which requires us to login first. In order to process all the transactions, first we have to login and get the cookie value...
10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
1
by: Satinderpal Singh | last post by:
Hi everyone, We are using HttpWebRequest to create a request to a URI, which requires us to login first. In order to process all the transactions, first we have to login and get the cookie value...
3
by: Jason | last post by:
I'm having a hard time getting a call to HttpWebRequest's GetRequestSteam to work. Each time I try to run it, I get the following error: The underlying connection was closed: Unable to...
7
by: gorkos | last post by:
Hi, I am two days trying to solve a problem with some pages, which i get through HTTPWebRequest. Error is that some pages need Script to be enabled. But how to do this in HTTPWebRequest class?
2
by: Bernie Yaeger | last post by:
I'm getting the following error - not always, only randomly - when I run a certain routine (the routine is a simple executenonquery and it appears to complete despite the message) against sql...
0
by: Agnes | last post by:
the application run in my office is very well. However, as it move to the client's company, Timeout and general network error always happend. We found that the firewall had a default setting "if it...
3
by: JansenH | last post by:
We have implemented a 'HTTP Post' client in C# that posts Xml documents to a webserver. This is working fine if the post rate is one post for every 20 seconds. But if the post rate is increased to...
2
by: =?Utf-8?B?TGFycnlLdXBlcm1hbg==?= | last post by:
Our WebDev team seems to have found a problem that exposes a bug in .NET 2.0. This problem can be shown when trying to access a WebService using SSL and through a proxy server after using the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.