Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi Guys

I have a VB program, lets call it AddressSearch. I have access to a 3rd party web service. I send the web service a post code, and it returns a list of valid addresses. Until recently.

Code hasn't changed, and (as far as we know) the web service hasn't been changed (do I trust the vendor?), and (as far as I know) the web proxy server hasn't been changed (do I trust my hardware manager?).

And yet when I send a valid post code from AddressSearch to the web service through the web proxy server I get the following Error Message:
System.Net.WebException: The request failed with HTTP status 417: Expectation.

If I go to the web service through my web browser (IE), through the web proxy, I get a valid list of addresses ... expected.

The VB.Net code used to get the default web proxy and default credentials (from Internet Options/Connections/LAN Settings I understand) is:

VB
If ws.Proxy Is Nothing Then
    ws.Proxy = WebRequest.DefaultWebProxy
    ws.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials
End If


where "ws" is a reference to the web service.

If I go back into Internet Options and turn off the "Use automatic configuration script", then run the same tests again, I get the following:

Send a valid post code from AddressSearch to the web service, I get back a valid list of addresses. Great!

Send an invalid post code to the web service through the web proxy server I get the following Error Message:
System.IndexOutOfRangeException: Index was outside the bounds of the array.

Through a web browser, I get a valid list of addresses.

So at first I was going to yell at the vendor, but I get a valid response from the web service via IE going through the web proxy.
Then I was going to kick the hardware manager, but again if I get a valid response from the web service via IE going through the web proxy, the web proxy isn't to blame.
I can't kick myself (just yet) as the code hasn't been altered for months.

Does it matter that my users use the AddressSearch through a terminal server session?

So now I am confused, and I need your help.

Thanks for reading!!

Simon
Posted

1 solution

 
Share this answer
 
Comments
Dylan Morley 10-Mar-11 10:31am    
Yep, should do it
SiBaggers 10-Mar-11 10:36am    
Thanks for that Dylan, but I'd already tried that and it didn't make any difference.
SiBaggers 10-Mar-11 10:44am    
WAIT WAIT WAIT
Piccadilly & Dylan ... thanks

I had tried the code, but that made no difference. But then I tried the settings in the config file and ... eureka

Fantastic, thanks for input

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900