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

HttpWebRequest problem when running program on server 20033

I made a program that does screen scraping from a website, but when running
this progran on a Win 2003 server the httpwebrequest works fine for a while
but suddenly never returns from the request (and doesn't time out either)
and I have to restart the program. It works fine on a winxp machine.
************************************************** ********
Sub Download_WebPage()
Dim strPost As String
Dim Lines As String
Dim DownloadOk As Boolean
Dim LoggedOn As Boolean
If Mode = "Logon" Then
GetLogonAddress()
LoggedOn = False
End If

strPost = Postdata

Dim myWebResponse As HttpWebResponse
Dim myWebRequest As HttpWebRequest
Dim myWriter As StreamWriter
Dim myReader As StreamReader
Dim PageIdOk As Boolean

Try
myWebRequest = CType(WebRequest.Create(Url), HttpWebRequest)
myWebRequest.CookieContainer = MyCookieContainer

If frm.NUpDownTimeout.Enabled Then myWebRequest.Timeout =
frm.NUpDownTimeout.Value * 1000 'Variable timeoutvalue

If strPost.Length > 0 Then 'If no postdata then don't post
myWebRequest.Method = "POST"
myWebRequest.ContentLength = strPost.Length
myWebRequest.ContentType =
"application/x-www-form-urlencoded"
myWriter = New
StreamWriter(myWebRequest.GetRequestStream())
myWriter.Write(strPost)
myWriter.Close()
End If

myWebResponse = CType(myWebRequest.GetResponse(),
HttpWebResponse)
myReader = New
StreamReader(myWebResponse.GetResponseStream())
Pagedata = myReader.ReadToEnd()
myWebResponse.Close()
LoggedOn = True
CheckPageId(PageId, DownloadOk, LoggedOn) 'Checking pageid
and if we are logged on
Catch e As WebException
DownloadOk = False
LoggedOn = False
Pagedata = FilterErrorMsg(e.ToString)
LogError(Now & "----Post_trade_data:" & Chr(13) & Chr(10) &
e.ToString)
Catch OtherExc As Exception
DownloadOk = False
LoggedOn = False
Pagedata = FilterErrorMsg(OtherExc.ToString)
LogError(Now & "----Post_trade_data:" & Chr(13) & Chr(10) &
OtherExc.ToString)
End Try

myWebResponse = Nothing
myWebRequest = Nothing
myWriter = Nothing
myReader = Nothing

RaiseEvent FinishedWeb(Pagedata, ThreadName, DownloadOk,
LoggedOn)

End Sub
Nov 20 '05 #1
1 1465
Cor
Hi Pål
I made a program that does screen scraping from a website, but when running
this progran on a Win 2003 server the httpwebrequest works fine for a while but suddenly never returns from the request (and doesn't time out either)
and I have to restart the program. It works fine on a winxp machine.


This answer came today in this newsgroup, maybe fits it your problem too.
The sender was Mr. T.
---------------------------------------------------------------------
Info: Problem is solved, John (MSFT) posted this solution which was a 100%
match in another group.

John Soulis wrote:

Please check to see if the article will apply to your issue.
817264 PRB: "Web Access Failed" Error Message When You Use Visual Studio
NET
http://support.microsoft.com/?id=817264

Thank you, John Soulis
Microsoft, ASP.NET

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

Nov 20 '05 #2

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

Similar topics

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...
8
by: Soeren S. Joergensen | last post by:
Hi, From a win-service I do a HttpWebRequest to a secure url with some parameters to get some simple data from a remote system used later on in a worker thread. When making the request from...
1
by: Deepak | last post by:
We retrieve data from a company called XYZ through httpwebrequest. The program is coded using VB.NET They have given a certificate to install. This certificate is included with the request...
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...
6
by: Oliver | last post by:
I have a very wired problem requesting one specific url from within my application. I have struggeled with this for 5 hours now, and searched google withour any luck, so i hope that someone are...
6
by: James MA | last post by:
I'm now writing a small program to communicate a web server to simulate a web client. I use te httpwebrequest to talk with the server, and it works find for "POST" method, however, when i test...
2
by: =?Utf-8?B?U2ltb25EZXY=?= | last post by:
Hi I have a utility class, called MailHandler, that I wrote to read and operate on emails on an Exchange server using WebDAV. The WebDAV SQL statements are sent using an HttpWebRequest object....
7
by: Marc Bartsch | last post by:
Hi, I have a background worker in my C# app that makes a synchronous HttpWebRequest.GetResponse() call. The idea is to POST a file to a server on the internet. When I call HttpWebRequest.Abort()...
0
by: =?Utf-8?B?TGFycnlLdXBlcm1hbg==?= | last post by:
Our WebDev team is experiencing a problem when trying to access a WebService using SSL and through a proxy server after using the HttpWebRequest object. Under normal circumstances we are able to...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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,...
0
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...
0
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,...
0
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...

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.