Error reading Web Page

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!
 
K

Karl Seguin [MVP]

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
 
K

Karl Seguin [MVP]

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top