473,382 Members | 1,359 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,382 software developers and data experts.

httpwebrequest timing out

RP
Hi all, I have some code that does a basic form post to an .aspx page
submitting some XML in the body. This code used to work on my WIN2K server
running .net 1.0 sp2. Now since I have upgraded to SBS2003 running ISA2K as
a proxy and .net 1.1 it basically hangs and times out. Here is the code
snippet. Any ideas? ISA is configured in Integrated mode and all clients are
SecureNAT Clients not required to authenticate.

Private Function ProcessRequest(byval strbody as string) as string
Dim returnstr as string

Dim wp as new WebProxy("http://sterling--atl:8080/", true)
GlobalProxySelection.Select = wp

Dim h as httpwebrequest =
Ctype(WebRequest.Create("http://sterling--atl/public/tmk.aspx"),
httpwebrequest)
h.Proxy = wp
h.KeepAlive = false
h.timeout = 10000
h.method = "POST"
h.contentlength = strbody.length
h.contenttype = "application/x-www-form-urlencoded"

Dim sw as new streamwriter(h.getrequeststream())
sw.write(strbody)
sw.close()

Dim hr as httpwebresponse = Ctype(h.getresponse(), httpwebresponse) ' CODE
BREAKS HERE.
Dim sr as new streamreader(hr.getresponsestream())
returnstr = sr.readtoend()
sr.close()

funcend:
return returnstr
End Function

Please Help!!
Nov 18 '05 #1
6 1554
RP
I switched the method to GET and it seems to be hitting it. Now why isnt
POST working? That is weird.

thanks

"RP" <rp@nospam.com> wrote in message
news:ek**************@TK2MSFTNGP12.phx.gbl...
Hi all, I have some code that does a basic form post to an .aspx page
submitting some XML in the body. This code used to work on my WIN2K server
running .net 1.0 sp2. Now since I have upgraded to SBS2003 running ISA2K as a proxy and .net 1.1 it basically hangs and times out. Here is the code
snippet. Any ideas? ISA is configured in Integrated mode and all clients are SecureNAT Clients not required to authenticate.

Private Function ProcessRequest(byval strbody as string) as string
Dim returnstr as string

Dim wp as new WebProxy("http://sterling--atl:8080/", true)
GlobalProxySelection.Select = wp

Dim h as httpwebrequest =
Ctype(WebRequest.Create("http://sterling--atl/public/tmk.aspx"),
httpwebrequest)
h.Proxy = wp
h.KeepAlive = false
h.timeout = 10000
h.method = "POST"
h.contentlength = strbody.length
h.contenttype = "application/x-www-form-urlencoded"

Dim sw as new streamwriter(h.getrequeststream())
sw.write(strbody)
sw.close()

Dim hr as httpwebresponse = Ctype(h.getresponse(), httpwebresponse) ' CODE BREAKS HERE.
Dim sr as new streamreader(hr.getresponsestream())
returnstr = sr.readtoend()
sr.close()

funcend:
return returnstr
End Function

Please Help!!

Nov 18 '05 #2
RP
OK. Narrowed it down even further. POST works with relatively small post
data like a string like "Hello World". With larger data I get the same time
out.

"RP" <rp@nospam.com> wrote in message
news:Ow**************@TK2MSFTNGP10.phx.gbl...
I switched the method to GET and it seems to be hitting it. Now why isnt
POST working? That is weird.

thanks

"RP" <rp@nospam.com> wrote in message
news:ek**************@TK2MSFTNGP12.phx.gbl...
Hi all, I have some code that does a basic form post to an .aspx page
submitting some XML in the body. This code used to work on my WIN2K server running .net 1.0 sp2. Now since I have upgraded to SBS2003 running ISA2K

as
a proxy and .net 1.1 it basically hangs and times out. Here is the code
snippet. Any ideas? ISA is configured in Integrated mode and all clients

are
SecureNAT Clients not required to authenticate.

Private Function ProcessRequest(byval strbody as string) as string
Dim returnstr as string

Dim wp as new WebProxy("http://sterling--atl:8080/", true)
GlobalProxySelection.Select = wp

Dim h as httpwebrequest =
Ctype(WebRequest.Create("http://sterling--atl/public/tmk.aspx"),
httpwebrequest)
h.Proxy = wp
h.KeepAlive = false
h.timeout = 10000
h.method = "POST"
h.contentlength = strbody.length
h.contenttype = "application/x-www-form-urlencoded"

Dim sw as new streamwriter(h.getrequeststream())
sw.write(strbody)
sw.close()

Dim hr as httpwebresponse = Ctype(h.getresponse(), httpwebresponse) '

CODE
BREAKS HERE.
Dim sr as new streamreader(hr.getresponsestream())
returnstr = sr.readtoend()
sr.close()

funcend:
return returnstr
End Function

Please Help!!


Nov 18 '05 #3
Depending on the client, try upgrading to the latest available IE security
patch, plus the following update:
http://support.microsoft.com/?id=831167

At the ISA end, you can try upgrading to Service Pack 1 (if you're not
already using it) and the Required Updates for Windows Server 2003:
http://www.microsoft.com/downloads/d...DisplayLang=en

--

This posting is provided "AS IS" with no warranties, and confers no rights.

"RP" <rp@nospam.com> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
OK. Narrowed it down even further. POST works with relatively small post
data like a string like "Hello World". With larger data I get the same time
out.

"RP" <rp@nospam.com> wrote in message
news:Ow**************@TK2MSFTNGP10.phx.gbl...
I switched the method to GET and it seems to be hitting it. Now why isnt
POST working? That is weird.

thanks

Nov 18 '05 #4
RP
Tristan, on the server i am running sbs2003 premium so it comes with isa2k
sp1 and isa seems to be working ok. I am on laresr ie6 sp1 also. This code
was working fine on my earlier environment. Ofcourse I had no ISA then.

thanks!

"Tristan Kington [MSFT]" <tr******@online.microsoft.com> wrote in message
news:#F**************@TK2MSFTNGP12.phx.gbl...
Depending on the client, try upgrading to the latest available IE security
patch, plus the following update:
http://support.microsoft.com/?id=831167

At the ISA end, you can try upgrading to Service Pack 1 (if you're not
already using it) and the Required Updates for Windows Server 2003:
http://www.microsoft.com/downloads/d...f87-5205-4779-
b1ab-fc338283b2d9&DisplayLang=en
--

This posting is provided "AS IS" with no warranties, and confers no rights.
"RP" <rp@nospam.com> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
OK. Narrowed it down even further. POST works with relatively small post
data like a string like "Hello World". With larger data I get the same time out.

"RP" <rp@nospam.com> wrote in message
news:Ow**************@TK2MSFTNGP10.phx.gbl...
I switched the method to GET and it seems to be hitting it. Now why isnt
POST working? That is weird.

thanks


Nov 18 '05 #5
Get a network sniff using (netmon, for eg) and see why the client is
hanging.

--
feroze
http://weblogs.asp.net/feroze_daud
============

Remove "user" from the email address to reply to the author.

This posting is provided "AS IS" with no warranties, and confers no rights

Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"RP" <rp@nospam.com> wrote in message
news:#f**************@TK2MSFTNGP10.phx.gbl...
Tristan, on the server i am running sbs2003 premium so it comes with isa2k
sp1 and isa seems to be working ok. I am on laresr ie6 sp1 also. This code
was working fine on my earlier environment. Ofcourse I had no ISA then.

thanks!

"Tristan Kington [MSFT]" <tr******@online.microsoft.com> wrote in message
news:#F**************@TK2MSFTNGP12.phx.gbl...
Depending on the client, try upgrading to the latest available IE security patch, plus the following update:
http://support.microsoft.com/?id=831167

At the ISA end, you can try upgrading to Service Pack 1 (if you're not
already using it) and the Required Updates for Windows Server 2003:

http://www.microsoft.com/downloads/d...f87-5205-4779- b1ab-fc338283b2d9&DisplayLang=en

--

This posting is provided "AS IS" with no warranties, and confers no

rights.

"RP" <rp@nospam.com> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
OK. Narrowed it down even further. POST works with relatively small post
data like a string like "Hello World". With larger data I get the same

time
out.

"RP" <rp@nospam.com> wrote in message
news:Ow**************@TK2MSFTNGP10.phx.gbl...
I switched the method to GET and it seems to be hitting it. Now why isnt POST working? That is weird.

thanks



Nov 18 '05 #6
RP wrote:
Hi all, I have some code that does a basic form post to an .aspx page
submitting some XML in the body. This code used to work on my WIN2K
server running .net 1.0 sp2. Now since I have upgraded to SBS2003
running ISA2K as a proxy and .net 1.1 it basically hangs and times
out. Here is the code snippet. Any ideas? ISA is configured in
Integrated mode and all clients are SecureNAT Clients not required to
authenticate.

Private Function ProcessRequest(byval strbody as string) as string
Dim returnstr as string

Dim wp as new WebProxy("http://sterling--atl:8080/", true)
GlobalProxySelection.Select = wp

Dim h as httpwebrequest =
Ctype(WebRequest.Create("http://sterling--atl/public/tmk.aspx"),
httpwebrequest)
h.Proxy = wp
h.KeepAlive = false
h.timeout = 10000
h.method = "POST"
h.contentlength = strbody.length
h.contenttype = "application/x-www-form-urlencoded"

Dim sw as new streamwriter(h.getrequeststream())
sw.write(strbody)
sw.close()


[...]

You're using a StreamWriter instance that implicitly uses UTF-8 encoding.
Unless you're sending pure ASCII content in strBody, the content length will
be greater than strbody's length, since non-ASCII characters will use two
ore more bytes. Thus, your Content-Length header will advertise a wrong
value. Avoid StreamWriter here and encode manually:

public void PostForm(string url, string formData, string encoding) {
byte[] content = Encoding.GetEncoding(encoding).GetBytes(formData);
string contentType =
String.Format("application/x-www-form-urlencoded; charset={0}",
encoding);

HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
request.Method = "POST";
request.ContentType = contentType;
request.ContentLength = content.Length;
// Do POST...
}

Cheers,

--
Joerg Jooss
jo*********@gmx.net

Nov 18 '05 #7

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

Similar topics

5
by: Dan Battagin | last post by:
Is there a known bug with the interaction between the HttpWebRequest and the ThreadPool? I current spawn several HttpWebRequest's using BeginGetResponse, and they work for a while, using worker...
9
by: Mike Cronin via DotNetMonster.com | last post by:
Hi there, Can anyone tell me what level of encryption is used when making an HTTPS POST request through an instance of the System.Net.HttpWebRequest object? Thanks much in advance! Mike...
16
by: thomas peter | last post by:
I am building a precache engine... one that request over 100 pages on an remote server to cache them remotely... can i use the HttpWebRequest and WebResponse classes for this? or must i use the...
0
by: Sivashankaran Vaidhyalingam | last post by:
Hi folks, I have an aspx application App A hosted in a server which is inside the intranet . I need to serve pages from this application _through_ another application App B which acts as a proxy...
1
by: Jeff B | last post by:
I'm trying to create a simple screen scraping application and I kept getting a System.Net.WebException thrown back with a message of "The operation has timed-out." At first I thought it was some...
1
by: sfoxover | last post by:
Hi, Could someone please give me some suggestions on how to make this class robust. I need to be able to handle around 20 similtanious requests to this class which causes a web browser to...
6
by: Mike Koerner | last post by:
Hi, I am having problems setting the HttpWebRequest Date header. I understand that it is a restricted header and I do receive the "This header must be modified with the appropriate property." ...
1
by: Chris Ashley | last post by:
We are calling a CGI Script on another server using the .NET httpwebrequest object. This works fine on our test server (IIS 5) but on our live server it is hanging (not even timing out). Any clue?...
1
by: Proogeren | last post by:
I have a problem with a httpwebrequest that I am creating. The request in itself looks correct but using fiddler I see that a www-authentication header is sent along as well. The code is pasted...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.