Results 1 to 3 of 3

Thread: QWebView logouts while surfing

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QWebView logouts while surfing

    Hi guys,
    I have a problem and need your help. I work with Qt 4.8.1
    The problem:
    I have one instance of QWebView and I set an url. Everything works and the page is loaded. The loaded WebApp requires login and uses cookies.
    After login the user can navigate through the webapp. After several navigations (variable) the session seems to expire and the login page appears.

    I tried a lots of things. I receive the cookie through QNetworkCookieJar and can read it.
    The raw format of the cookie looks like this: JSESSIONID=C419FDE26FE26E68988AE3D6E3D90D77; secure; HttpOnly; domain=xxx.yyyy.com; path=/share/

    So the cookie is there, but the session is lost after some navigations. Maybe you can give me a hint what's the problem. It's just one instance of QWebView and one WebApp!

    And server config says, that a sessioncookie expires after one hour. On FireFox or Chrome it works as expected.

    It would be very nice to solve this problem,
    thank u
    Last edited by Qiieha; 28th February 2014 at 15:42.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QWebView logouts while surfing

    One thing you could check by subclassing QNetworkCookieJar and overwriting cookiesForUrl() is, if the base implementation does not return the cookie and if it does indeed not, if it still has it.
    You can then also check if maybe the URL changed, so it is no longer found.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    Qiieha (3rd March 2014)

  4. #3
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWebView logouts while surfing

    Thank you man. You shoved me in the right direction!!

    The url changes every time, and after some navigations the cookie was lost. So I chache the session cookie, if get it, and append the cached cookie to the list of cookies in cookiesForUrl.
    Now there aren't logouts --> perfect

    bye

Similar Threads

  1. Replies: 8
    Last Post: 3rd September 2013, 09:51
  2. QWebView
    By Magu in forum Newbie
    Replies: 1
    Last Post: 22nd October 2009, 09:06
  3. QWebView
    By giusepped in forum Qt Programming
    Replies: 3
    Last Post: 18th March 2009, 05:32
  4. QWebView
    By ivi2501 in forum Qt Programming
    Replies: 1
    Last Post: 30th December 2008, 12:57
  5. QwebView
    By peace_comp in forum Qt Programming
    Replies: 0
    Last Post: 30th July 2008, 18:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.