473,626 Members | 3,343 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

expert Help Please HttpWebResponse --The operation has timed-out.

Tom
Hi, Could someone please help me with this

I am trying to do use the following code to post a form and get
response but it 's keep giving me a error "The operation has
timed-out." on this line

oRespons = CType(oRequest. GetResponse(), HttpWebResponse )

I have to us Unicode Encoding so it knows national charactor.

Please help how can i make this work

here is the code

Public Function DoHttpRequest(B yVal strWWWAddress As String, ByVal
strdata As String, ByRef strResult As String, ByRef iStatusCode As
HttpStatusCode) As Boolean
Dim bolReturn As Boolean

Dim strMethodName As String

strResult = ""

iStatusCode = HttpStatusCode. Unused

Dim timeRequestStar t As DateTime = DateTime.Now

Dim oRequest As HttpWebRequest = Nothing

Dim oInStream As Stream = Nothing

Dim oRespons As HttpWebResponse = Nothing

Dim readStream As StreamReader = Nothing

Dim oEncoding As Encoding = Encoding.Unicod e

Try
Dim bSendData As Boolean

strMethodName = "POST"

oRequest = CType(WebReques t.Create(strWWW Address),
HttpWebRequest)

oRequest.Method = strMethodName
oRequest.Conten tType = "applicatio n/x-www-form-urlencoded"
oRequest.Servic ePoint.Expect10 0Continue = False
oRequest.Timeou t = 10 * 1000
' oRequest.Creden tials = New NetworkCredenti al("UserName",
"Password")
oRequest.Servic ePoint.Connecti onLimit = 15

If bSendData Then

oInStream = oRequest.GetReq uestStream()

Dim data As Byte() = oEncoding.GetBy tes(strdata)

oInStream.Write (data, 0, data.Length)

oInStream.Flush ()

oInStream.Close ()
oInStream = Nothing
End If

oRespons = CType(oRequest. GetResponse(), HttpWebResponse )

readStream = New StreamReader(oR espons.GetRespo nseStream(),
Encoding.Unicod e)

strResult = readStream.Read ToEnd()

readStream.Clos e()
readStream = Nothing

iStatusCode = oRespons.Status Code

oRespons.Close( )
oRespons = Nothing

bolReturn = True
Catch ex As Exception

' Me.EmailAdmin(e x.Message, ex.StackTrace)
'bolReturn = False
Finally

If Not (oInStream Is Nothing) Then
oInStream.Close ()
End If
If Not (readStream Is Nothing) Then
readStream.Clos e()
End If
If Not (oRespons Is Nothing) Then
oRespons.Close( )
End If
End Try

Return bolReturn
End Function 'DoHttpRequest
to call this function

in form_load
Dim param As Byte() =
HttpContext.Cur rent.Request.Bi naryRead(HttpCo ntext.Current.R equest.ContentL ength)
Dim ps As String = Encoding.Unicod e.GetString(par am)

ps += "&cmd=_noti fy-validate"

Dim status As System.Net.Http StatusCode

If DoHttpRequest(" https://www.paypal.com/cgi-bin/webscr",
ps, strResponse, status) = False Then
' do insert to DB
end if

-------------------------------------------------------------------------------------------------------
please reply to my email becasue i had a hard time finding what i
posted so i had to repost again, my email is me******@hotmai l.com

Thank you

Nov 29 '06 #1
0 1447

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

Similar topics

1
13125
by: laks | last post by:
Hi all I have the following piece of code for retrieving some info from an external url. I receive an error - "The operation has timed-out" at GetResponse() line. I have tried extending the time out duration. I dont have any SETI etc on my computer. Anything wrong in code? how can i resolve my issue? Any insight highly appreciated.. thanks
1
2276
by: | last post by:
I am performing several httpwebrequest and webresponse operations to download some wav files. I included the sample code below. When I execute these commands they work for a while and then 5 - 50 minutes into doing its thing i will start to get errors like: System.Net.WebException: The operation has timed-out My function I call is GetWaveFile(Wav9,"Wav9",sFileName); it is in a service that grabs a different wav file every 5...
0
1297
by: yariv | last post by:
Hello All, I am having a very strange problem. while trying to access http page on the web. I happen to have some problems at specific machines. the exception I get is: ************* Exception Text ************** System.Net.WebException: The operation has timed-out. at System.Net.HttpWebRequest.GetResponse()
0
1578
by: Matt | last post by:
(can't find any of my previous post for same issue. please CC to my email address as well. Thanks!) Hi all, What is the possible reason that HttpWebRequest.GetRequestStream() may hang there until a timeout exception. Here is the stack trace and code snippet. Please do help. --Matt // stack trace System.Net.HttpWebRequest.GetRequestStream() +190
5
9021
by: Sachin Surana | last post by:
We use HttpWebRequest to send the request at a URL. But some times the method GetResponse throws a time out exception. But when we check the IIS logs, there is no such entry. So the request never reached the server but the client is getting a time out exception. What could be the possible reasons? Confirmed that the request does not get lost in the network.
4
13175
by: VB Programmer | last post by:
When I run my ASP.NET 2.0 web app on my dev machine it works perfect. When I precomile it to my web deployment project and then copy the debug files to my web server I get this problem when trying to login (obviously it's using ASPNETDB.mdf). Any ideas? Server Error in '/' Application. --------------------------------------------------------------------------------
1
1342
by: Andy Chen | last post by:
Hi all, Please help me to look at the following code, I always get a 'The operation has timed-out.' exception. But the URL can be opened in IE properly. I am wondering if I missed some code. Any help would appreciate!! HttpWebRequest httpReq; HttpWebResponse httpResp; try {
1
1307
by: goal2007 | last post by:
I was getting SQLException Time out so i added this line cmd.CommandTimeout = 1000; also in my ScriptManager i set AsyncPostBackTimeout="1200". now when i run my application all what i get is this The operation has timedout. no further explanation from where it is hapning. Any Thoughts! Thanks
0
8272
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8205
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8713
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8644
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8514
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7206
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5579
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2632
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1516
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.