Real Software Forums

Logging into and displaying web page in HTMLViewer
Page 1 of 1

Author:  judgedoug [ Fri Mar 22, 2013 11:46 am ]
Post subject:  Logging into and displaying web page in HTMLViewer

Hi everyone,
attempting to do something I've never done before, and I'm confusing myself more and more so I thought I'd post here and see if anyone has done something similar and could offer advice.

I've got an internal CRM application, and one of the functions I'm working on is for it to access and display the company's internal Wiki page (where company procedures are stored, etc). This is a normal mediawiki setup. The user info for logging into the CRM are mirrored for the user info for the Wiki (editing rights, etc).

Basically, I need to access the Mediawiki api to log in, set a session cookie, and then use HTMLViewer to display the Wiki with the user already logged in.

But from what I can understand, there's nothing that ties HTTPSocket to HTMLViewer.

I am able to log in automatically using HTTPSocket and parsing the login request, then retrieving the session cookies and such. When I send the results to the HTMLViewer, the page has the user logged in. But any additional navigate, the user is not logged in any more - as the htmlViewer does not have a way to access the HTTPSocket's session cookies.

Is there any way to do this? Have the HTTPSocket automatically log into a webpage and have the cookies saved so the user can navigate the webpage on the HTMLViewer?


Author:  judgedoug [ Fri Mar 22, 2013 2:51 pm ]
Post subject:  Re: Logging into and displaying web page in HTMLViewer

I think I might have figured it out.

When the HTTPSocket finishes it's login authentication and gets it's cookies, it posts back to itself the main url.

In the HTTPSocket.PageReceived event, it sets a RePost bool to FALSE and then activates HTMLViewer.LoadURL and passes the URL.

In the HTMLViewer.DocumentBegin event, if the RePost bool is TRUE, it cancels itself and then reposts the URL to the HTTPSocket, otherwise it sets the RePost bool to TRUE.

Basically the HTTPSocket handles the navigation and successfully keeps it's cookies. When the user clicks on a link in the HTMLViewer it cancels any further HTMLViewer processing and then posts the url to the HTTPSocket, which then handles the interaction and sends the url back to HTMLViewer to load it.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group