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

HttpWebRequest and "Too many automatic redirections"

This doesn't happen on my development machine (code works perfectly) but on the client's machine, I get an error reported that "too many automatic redirections". I've tried setting the maximum to a large number without prevail.

I used InternetOpenURL in the past (VB6) without incident.

Can anyone help?

Public Function GetPage(ByVal bClearPayload As Boolean) As String
Dim objResponse As WebResponse
Try
Dim objRequest As HttpWebRequest
Dim objRequestStream, objReceiveStream As Stream
Dim objReader As StreamReader
Dim bytPayload() As Byte
Dim szURL As String

'now it's time to encode the payload (payload is set by properties
Dim szPayloadForm As String = GetPayloadFromNameValue(m_objForm)
Dim szPayloadQuery As String = GetPayloadFromNameValue(m_objWebClient.QueryString )

szURL = m_szURL 'module level set by property

If Not szPayloadQuery Is Nothing AndAlso szPayloadQuery.Length > 0 Then
szURL = String.Format("{0}?{1}", szURL, EncodePayload(szPayloadQuery))
End If

objRequest = DirectCast(WebRequest.Create(szURL), HttpWebRequest)

If Not szPayloadForm Is Nothing AndAlso szPayloadForm.Length > 0 Then
objRequest.Method = "POST"
objRequest.ContentType = "application/x-www-form-urlencoded"
bytPayload = System.Text.Encoding.UTF8.GetBytes(EncodePayload(s zPayloadForm))
objRequest.ContentLength = bytPayload.Length
objRequestStream = objRequest.GetRequestStream()
objRequestStream.Write(bytPayload, 0, bytPayload.Length)
objRequestStream.Close()
Else
objRequest.Method = "GET"
End If

With objRequest
.CookieContainer = New CookieContainer
End With

objResponse = objRequest.GetResponse() 'EXCEPTION RAISES HERE
objReceiveStream = objResponse.GetResponseStream()
objReader = New StreamReader(objReceiveStream, Encoding.ASCII)

Dim chrRead(256) As Char
Dim nCount As Integer = objReader.Read(chrRead, 0, 256)
Dim sbResponse As New System.Text.StringBuilder

Do Until nCount = 0
Dim str As String = New String(chrRead, 0, nCount)
sbResponse.Append(str)
nCount = objReader.Read(chrRead, 0, 256)
Loop

Return sbResponse.ToString

Catch Ex As Exception
Throw Ex
Finally
If Not objResponse Is Nothing Then
objResponse.Close()
End If

If bClearPayload Then
m_objForm.Clear()
m_objWebClient.QueryString.Clear()
End If
End Try
End Function
Nov 20 '05 #1
1 2155
Cor
Hi Anthony,
This doesn't happen on my development machine (code works perfectly) but on the client's machine, I get an error reported that "too many automatic >redirections". I've tried setting the maximum to a large number without prevail.


I did not look at your code (because it works on your computer why not on the client, than it can not be something by code where my thoughts).

My first thoughts where, has the client maybe some other connection open and is he using http1.1.
As far as I know is it only possible to have two http1.1 connections open in one time.
Cor

Nov 20 '05 #2

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

Similar topics

8
by: RC | last post by:
In my Access 2002 form, I have a combo box and on the AfterUpdate event I use DoCmd.RunSQL ("UPDATE .... to update records in a table. When it starts to run I get a message "You are about to...
11
by: MLH | last post by:
If this is what MySQL is set to... SELECT DISTINCTROW qryVehiclesNowners5.SerialNum, qryVehiclesNowners5.VDescr, qryVehiclesNowners5.Owner, qryVehiclesNowners5.VehicleJobID ,...
1
by: Philip Bondi | last post by:
Hello to all SQL Server junkies who work with non-English characters: For people running scripts from the command line using ANSI files with special characters, it is very important to use isql...
7
by: jnikle | last post by:
I have a database in A2003 format that's giving me this error, but it's not the same situation I've been reading about on here. In my development copy, I have imported copies of the backend's...
4
by: Philip Nelson | last post by:
Folks, I've got a database and tablespaces "managed by automatic storage". I've deleted a lot of data from some tables. I've then reorged them. But the tablespaces don't appear to shrink...
0
by: minapatel | last post by:
I have the following procedure CREATE OR REPLACE procedure FOL_PURGE_CASES as /* type "SET SERVEROUTPUT ON" in sqlplus to debug !! */ cursor all_cases is cursor all_cases is ...
0
by: sherkhan | last post by:
Hello Everyone. I have come across this article (http://dast.nlanr.net/Projects/ Autobuf_v1.0/autotcp.html) called "Automatic TCP window tuning". After my first newbie file transfer I wrote and...
3
by: DrVitoti | last post by:
On that program the compiler says "parse error" on line 8, 10, 12 and 21, it also says "too many arguments" on lines 10, 12 and finally it says "at this port in" on lines 13, 14, 20 . How could I...
30
by: Medvedev | last post by:
i see serveral source codes , and i found they almost only use "new" and "delete" keywords to make they object. Why should i do that , and as i know the object is going to be destroy by itself at...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.