472,344 Members | 1,387 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,344 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 1506
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...
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...
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...
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...
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...
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...
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...
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...
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

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.