473,324 Members | 2,002 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,324 software developers and data experts.

httpwebrequest problems

I am using httpwebrequest to do a screen scrape.

This works great on my development box, but does not on the production box.

Here is the code.

Dim webRequest As HttpWebRequest = CType(webRequest.Create(LOGIN_URL),
HttpWebRequest)
webRequest.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy
webRequest.KeepAlive = False
Dim responseReader As StreamReader = New
StreamReader(webRequest.GetResponse.GetResponseStr eam)
Dim responseData As String = responseReader.ReadToEnd
responseReader.Close()

On my production box, I get this error:
The underlying connection was closed. Unable to connect to the remote server.

I have made sure I have .NET framework 1.1 SP 1 installed

I have added the following code to my web.config file

<system.net>
<defaultProxy>
<proxy
usesystemdefault = "false"
proxyaddress="http://proxy:port"
bypassonlocal="false"
/>
</defaultProxy>
</system.net>

And now I am at a loss?

Any thoughts?
Thanks

--
Tyler
May 3 '06 #1
2 3314
Um,
don't you want GetDefaultProxy, not
webRequest.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy

Its' DefaultProxy that you show in your config. You can also try more
specific code like this:

if (ConfigurationSettings.AppSettings["proxy"] != null)
{
WebProxy p = null;
string proxyAddressAndPort =
ConfigurationSettings.AppSettings["proxy"];
string proxyUserName =
ConfigurationSettings.AppSettings["proxyUserName"];
string proxyPassword =
ConfigurationSettings.AppSettings["proxyPassword"];
ICredentials cred;
cred = new NetworkCredential(proxyUserName, proxyPassword);
p = new WebProxy(proxyAddressAndPort, true, null, cred);
GlobalProxySelection.Select = p;
}
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Tyler" wrote:
I am using httpwebrequest to do a screen scrape.

This works great on my development box, but does not on the production box.

Here is the code.

Dim webRequest As HttpWebRequest = CType(webRequest.Create(LOGIN_URL),
HttpWebRequest)
webRequest.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy
webRequest.KeepAlive = False
Dim responseReader As StreamReader = New
StreamReader(webRequest.GetResponse.GetResponseStr eam)
Dim responseData As String = responseReader.ReadToEnd
responseReader.Close()

On my production box, I get this error:
The underlying connection was closed. Unable to connect to the remote server.

I have made sure I have .NET framework 1.1 SP 1 installed

I have added the following code to my web.config file

<system.net>
<defaultProxy>
<proxy
usesystemdefault = "false"
proxyaddress="http://proxy:port"
bypassonlocal="false"
/>
</defaultProxy>
</system.net>

And now I am at a loss?

Any thoughts?
Thanks

--
Tyler

May 3 '06 #2
Thanks for your response Peter. I tried both suggestions with the same
result. This one has me baffled. I can type the url into a browser on the
production box and it will pull up the site just fine. And again, it works
on my development box, but not the production box.
--
Tyler
"Peter Bromberg [C# MVP]" wrote:
Um,
don't you want GetDefaultProxy, not
webRequest.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy

Its' DefaultProxy that you show in your config. You can also try more
specific code like this:

if (ConfigurationSettings.AppSettings["proxy"] != null)
{
WebProxy p = null;
string proxyAddressAndPort =
ConfigurationSettings.AppSettings["proxy"];
string proxyUserName =
ConfigurationSettings.AppSettings["proxyUserName"];
string proxyPassword =
ConfigurationSettings.AppSettings["proxyPassword"];
ICredentials cred;
cred = new NetworkCredential(proxyUserName, proxyPassword);
p = new WebProxy(proxyAddressAndPort, true, null, cred);
GlobalProxySelection.Select = p;
}
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Tyler" wrote:
I am using httpwebrequest to do a screen scrape.

This works great on my development box, but does not on the production box.

Here is the code.

Dim webRequest As HttpWebRequest = CType(webRequest.Create(LOGIN_URL),
HttpWebRequest)
webRequest.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy
webRequest.KeepAlive = False
Dim responseReader As StreamReader = New
StreamReader(webRequest.GetResponse.GetResponseStr eam)
Dim responseData As String = responseReader.ReadToEnd
responseReader.Close()

On my production box, I get this error:
The underlying connection was closed. Unable to connect to the remote server.

I have made sure I have .NET framework 1.1 SP 1 installed

I have added the following code to my web.config file

<system.net>
<defaultProxy>
<proxy
usesystemdefault = "false"
proxyaddress="http://proxy:port"
bypassonlocal="false"
/>
</defaultProxy>
</system.net>

And now I am at a loss?

Any thoughts?
Thanks

--
Tyler

May 3 '06 #3

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...
4
by: Steven Pu | last post by:
Hi, Specifically, the website I am trying to access is, https://gmail.google.com/ I've read elsewhere that Google only uses SSL2, while .NET uses SSL3 and is not backward compatible. Is...
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...
15
by: warlord | last post by:
I have a windows client app that is trying to download a file from a web server but I always get the following error when I call the GetResponse method of the Request object. The remote server...
2
by: GlennLanier | last post by:
Hello, I've searched the forums and can't find an answer -- if it i there, kindly point me in that direction. I would like to simulate a browser POSTing a FORM and be able to pars the response....
1
by: Imran Aziz | last post by:
Hello All, I am using HttpWebRequest to fetch webpages in my ASP.net C# application. The request works fine without the proxy, but on using the code from within a network that uses proxy the...
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." ...
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...
3
by: matadon | last post by:
Hi, I am writing a C# app. I have a finite (~50) set of URLs that I am continuously polling in a circular manner. I would like to do this in a way that can send out each of the requests and get...
2
by: =?Utf-8?B?TGFycnlLdXBlcm1hbg==?= | last post by:
Our WebDev team seems to have found a problem that exposes a bug in .NET 2.0. This problem can be shown when trying to access a WebService using SSL and through a proxy server after using the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.