Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > HttpWebRequest Timout Error Problem

Reply
Thread Tools

HttpWebRequest Timout Error Problem

 
 
Matt
Guest
Posts: n/a
 
      01-28-2004
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();
}
 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      01-28-2004
"Matt" <(E-Mail Removed)> 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.


 
Reply With Quote
 
 
 
 
Fred H
Guest
Posts: n/a
 
      01-28-2004


> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
configure idle timout for Cisco vpnclient for linux 4.6.0 aasim.ss@gmail.com Cisco 1 06-23-2005 05:42 AM
upload timout problem Dean g ASP General 2 05-10-2005 03:16 PM
dialer idle-timout doesn't get reset Dennis Ortsen Cisco 4 08-03-2004 02:42 PM
Problems with image render timout when browsing on local machine. Ken Varn ASP .Net 2 05-28-2004 12:35 PM
Session timout problem =?Utf-8?B?bWc=?= ASP .Net 4 02-23-2004 03:19 AM



Advertisments