Cookie is not set for all the calls which are initiated from inside of a jsp call.

  • I am making a call to a jsp file using QWebEngine. In that I am passing my Session Id which goes correctly.
    And I am setting the Cookie in the cookie store using a QWebEngineProfile. The cookie gets set for my first call but then it is not been set for other calls which are initiated from the jsp.

    *QWebEngineSettings webEngineSettings = QWebEngineSettings::defaultSettings(); webEngineSettings>setAttribute(QWebEngineSettings::WebAttribute::AutoLoadImages, true); webEngineSettings>setAttribute(QWebEngineSettings::WebAttribute::JavascriptEnabled, true);
    webEngineSettings>setAttribute(QWebEngineSettings::WebAttribute::LocalStorageEnabled, true);

    QWebEngineProfile* profile = new QWebEngineProfile("abc", parent);
    QWebEngineCookieStore* cookieStore = profile->cookieStore();
    QNetworkCookie* webEngineNewCookie = new NetworkCookie(QByteArray("MyCookie"), QByteArray("1234"));
    QUrl url = ""
    cookieStore->setCookie(*webEngineNewCookie, QUrl(url));
    QStringList location = QStandardPaths::standardLocations(QStandardPaths::CacheLocation);

    QWebEnginePage* page = new QWebEnginePage(profile,parent);

    QWebEngineHttpRequest* webEngineHttpReq = new QWebEngineHttpRequest(QUrl(url), QWebEngineHttpRequest::Post);

    When I make this call then I do get the cookie in this ( but after this another calls are initiated from help.jsp those call does not have may cookies so they are blocked by the server.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.