404 error with Push example using WebHTMLViewer.loadpage

Howdy folks.

I’m trying to push data to multiple sessions and I get a 404 error. I reviewed the push example and copied the properties and code necessary to push data to each session’s MainPage (something like a chat program) HTMLViewer1. I create html data in an App property string and I want it to pushed out. S1=Session 1, S2=Session 2 for reference. Here’s the push code:

Dim Blab as String = DecodeURLComponent(BlabsText) For i As Integer = 0 To Ubound(App.MainPages) App.MainPages(i).HTMLViewer1.LoadPage(Blab) Next

S1 creates text and it calls the App.methods necessary to check the data. Once the data is verified it writes the data to the App.BlabsText then calls a method to push the data out. This works and HTMLViewer1 is loaded properly on S1.

S2 receives a 404 error:

[code]404: File Not Found

The requested URL “/C6CBBAC23D3B8B49A627110F1C4672A7/files/6506-3250-6841-5129-7791/source.html” could not be found. Please check your request and try again.

Remote Address: [/code]

Then S2 creates text and it does its thing like S1 just did. Except S2 gets the proper data and S1 gets the 404 error.

I mean, its updating all the sessions, just every session other than the one that sends the data gets a 404.

Any ideas? Thanks for any help you can provide!

Do you have a sample project you can share?

When you call LoadPage, WebHTMLViewer has to create a WebFile in the background so the content can be delivered to the page. The problem you are running into is because that WebFile is attached to the Session that you’re calling it from.

The solution is to create your own WebFile object and store it as a property of App or a Module and then make sure that the Session property is set to Nil. Then instead of LoadPage, you’ll set the URL property to the URL property of the WebFile:

myHTMLViewer.URL = myWebFile.URL

@Paul Lefebvre

You can download here .

@Greg O’Lone

If the multiple sessions are on the same machine, even in different browsers, there is no problem. But if you have multiple sessions on one machine and a single session on a separate system the multiple sessions throw an error while the single doesn’t and vice versa. I haven’t done too much more testing. Its awfully weird.

The error on the same system shows two different files at the same time:

Firefox:

[code]404: File Not Found

The requested URL “/6AC9FE8421A6CA5B22718BD0468A9084/files/2430-8019-4712-5283-2536/source.html” could not be found. Please check your request and try again.[/code]

Chrome:

[code]404: File Not Found

The requested URL “/6AC9FE8421A6CA5B22718BD0468A9084/files/9402-2623-8492-4922-1132/source.html” could not be found. Please check your request and try again.[/code]

But if there are separate files for sessions it shouldn’t work on the same system then. But it does.

Greg’s suggestion seemed to work for me with your project. I added a BlabFile As WebFile property to App. In UpdateBlabs, I create a FolderItem, put the Blab html text into it, then open it as a WebFile (with a Nil Session) and use HTMLViewer.URL to load it. I’m able to get the messages to appear across multiple systems (or multiple sessions on the same system) without an error.

Here is the project.

That certainly worked and thanks for working on it. The fix here is the better choice of the two anyway since I can put it in a temporary shared memory location to save disk writes and reads.

Thanks guys!