Atozed Forums
Problems with cookies in IW15 - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: Problems with cookies in IW15 (/thread-2624.html)



Problems with cookies in IW15 - Per Waernborg - 01-18-2022

Hi,
I have a well working application in IntraWeb 5.2.26 in Indy-mode and I uses cookies to remember login information. This works perfect for me on my computers.

But for some of my customers the "remember me"-function doesn't work. 

I have the following CookieOptions:

CookieNameSuffix: "empty"
HttpOnly: False
SameSite: ssoLax
Secure: False
SessionCookies: True
UseCookies: True 


I can't find any reason for this, it makes no sense. Any idears of what could be wrong?

Best Regards
Per


RE: Problems with cookies in IW15 - Alexandre Machado - 01-19-2022

Can you please show the code used to set the cookie information?


RE: Problems with cookies in IW15 - Per Waernborg - 02-04-2022

Save:
UserSession.CookiePut( 'BizPointUser', Anvandare );
UserSession.CookiePut( 'BizPointPassword', Losen );

Load:
if UserSession.CookieExists( 'BizPointUser' ) then
  begin
    Anvandare := Usersession.CookieGet( 'BizPointUser' );
    Losen := Usersession.CookieGet( 'BizPointPassword' );
    ...
  end;


RE: Problems with cookies in IW15 - Per Waernborg - 02-11-2022

Sorry, missed my functions in UserSession:

procedure TIWUserSession.CookieDelete(Namn: string);
begin
Webapplication.Response.Cookies.RemoveCookie( Namn, webapplication.cookiepath );
end;

function TIWUserSession.CookieExists(Namn: string): Boolean;
begin
Result := WebApplication.Request.CookieFields.IndexOfName( Namn ) > -1;
end;

function TIWUserSession.CookieGet(Namn: string): string;
var
V: string;
begin
V := WebApplication.Request.CookieFields.Values[ Namn ];
Result := TNetEncoding.URL.Decode( V );
end;

procedure TIWUserSession.CookiePut(Namn, Value: string);
var
V: string;
begin
V := TNetEncoding.URL.Encode( Value );
Webapplication.Response.Cookies.Add(THttpCookie.create( Namn, V, webapplication.cookiepath, Date + 999, true, true ) );
end;