HTMLViewer and source code ... redirect?

Not sure what is going on here. Why does this code not work for

Instead of getting the source code which I can view in my browser, this is returning :

“??301 Moved Permanently??

Moved Permanently


The document has moved here.

??” telling me the document has moved to the page I’m dl’ing from??

TextField1.Text = “

[code]dim s,uri as string
dim h as new HTTPSocket
TextArea1.Text = s

Dim url As String = tf_uri.Text

To clarify:

The problem is that the string returned is NOT the source code for the page, but a 301 redirect warning. I plugged in the defineencoding just to check, but now I simply get a cleaner version:

<title>301 Moved Permanently</title>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="">here</a>.</p>

Which of course is not the source code to the xojo home page, which should begin like this:


Xojo: Cross-platform App Development Tool [/code]

I’m not sure what’s going on…

Hi Dave,

Try using HTTPSecureSocket or Xojo.Net.HTTPSocket instead.


Okay, I’ve subclassed the HTTPSecureSocket, but must be missing a step as now I’m getting back a bad request:


400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.


Here’s my code:

[code]dim s,uri as String

// I get the above if this next line is commented out. If I have it active, then nothing returns in the pagereceived event.
fcthis1.Secure = True


fcthis1 is a subclassed HTTPSecureSocket and this is the code in the PageReceived event:

TextArea1.Text = defineencoding(content, encodings.utf8)

Bizarrely, the above now works. Perhaps there was cache at the ISP, I dunno.

Well, first you may need to define encoding for your returned string to get the new lines correctly displayed.
And second you need to follow redirect.

Our CURLSMBS class can be configured to do this…