Jump to content

How to Delete Cookie ?


FFREDIANELLI

Recommended Posts

Hi,

 

You can use something like this:

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  I : Integer;
begin
  if UniApplication.Cookies.Count > 0 then
    for I := 0 to UniApplication.Cookies.Count - 1 do
      if Pos('wmn_', UniApplication.Cookies[I]) <> 0 then
        UniApplication.Cookies.SetCookie(UniApplication.Cookies[I],'',Date-1);
end;
Link to comment
Share on other sites

 

Hi,

 

You can use something like this:

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  I : Integer;
begin
  if UniApplication.Cookies.Count > 0 then
    for I := 0 to UniApplication.Cookies.Count - 1 do
      if Pos('wmn_', UniApplication.Cookies[I]) <> 0 then
        UniApplication.Cookies.SetCookie(UniApplication.Cookies[I],'',Date-1);
end;

 

Just for others that may use the same code, it only worked after removing everithing after the '=' sign that came with the UniApplication.Cookies , it return 'wmn_nome=fabio' that is not the name of the cookie, so the code that worked changed to:

var
  I: integer;
begin
  if UniApplication.Cookies.Count > 0 then
    for I := 0 to UniApplication.Cookies.Count - 1 do
      if Pos('wmn_', UniApplication.Cookies) <> 0 then
        UniApplication.Cookies.SetCookie(copy(UniApplication.Cookies,1,pos('=',UniApplication.Cookies)-1), '',
          Date - 1);
  UniApplication.Terminate('Safe logout executed , Thanks !');
end;
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...