Error reading Web Page

  • Thread starter Thread starter TCB
  • Start date Start date
T

TCB

I am getting this error while tryin to read the contents of a Web page so I
can send them in an email:
"Too many automatic redirections were attempted."

This is the code I am using

Private Function readHtmlPage(ByVal url As String) As [String]
Dim result As [String]
Dim objResponse As WebResponse
Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(url)
objResponse = objRequest.GetResponse()
Dim sr As New StreamReader(objResponse.GetResponseStream())
Try
result = sr.ReadToEnd()
' Close and clean up the StreamReader
sr.Close()
Finally
sr.Dispose()
End Try
Return result
End Function

I cannot find any documentation on how to fix this problem.

THANKS!
 
it looks like the page keeps redirecting to itself...I think it's a problem
with the URL you are requesting. Maybe it's expecting certain header
parameters...

Karl
 
It's hard to tell. (a) outlook could be blocking it...more likely, the aspx
file has somet type of leeching protection built-into it. They might check
for referrer or somethig...it's hard to tell.

Karl
--
http://www.openmymind.net/



TCB said:
Thank you, got that part working. Now the page i am trying to send
contains some thumbnails generated by another .aspx webform so the image
source for those images is something like:

src="http://www.mydomain.com/MidThumbnai...amp;HorSize=160&VerSize=120&ImageNo=1

But this images do not load in outlook when I open the mail message

THANKS


TCB said:
I am getting this error while tryin to read the contents of a Web page so
I can send them in an email:
"Too many automatic redirections were attempted."

This is the code I am using

Private Function readHtmlPage(ByVal url As String) As [String]
Dim result As [String]
Dim objResponse As WebResponse
Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(url)
objResponse = objRequest.GetResponse()
Dim sr As New StreamReader(objResponse.GetResponseStream())
Try
result = sr.ReadToEnd()
' Close and clean up the StreamReader
sr.Close()
Finally
sr.Dispose()
End Try
Return result
End Function

I cannot find any documentation on how to fix this problem.

THANKS!
 
Back
Top