delphidelphi-xe2intraweb

Delphi XE2, Intraweb 2.1.23 and cookies


i did everything exactly the same as in the cookies example (shown here http://www.atozed.com/intraweb/docs/Develop/Cookies.aspx), but it's not compiling and it says "[DCC Error] Login.pas(38): E2035 Not enough actual parameters" and places the courser right after the "WebApplication.Response.Cooki­es.Add"

what am i missing? is there a unit i need to add to the uses?

i use Delphi XE2, and Intraweb 2.1.23 oh, and i'm new to intraweb...

please help thank you


Solution

  • Here is a working code block that will create a Cookie in Intraweb 12.2.8 XE2

    make sure that you add IW.HTTP.Cookie in your uses clause.

    and of course you will have to modify the TiwfrmMain to match your iwform and also declare the procedure :) via: procedure MakeCookie; in your

    procedure TiwfrmMain.MakeCookie;
        var cookieMain: THttpCookie;
    
    begin
    
     try
      cookieMain:=  THttpCookie.Create('email',editLogin.Text,'',Date + 999);
      WebApplication.Response.Cookies.Add(cookieMain);
      cookieMain.free;  
     except
    
     end;
    
    end;
    

    and you can also then get it via:

    procedure TiwfrmMain.SetCookie;
    begin
      try
    
    
        if WebApplication.Request.CookieFields.IndexOfName('email')> -1 then
        editLogin.Text := WebApplication.Request.CookieFields.Values['email'];
    
    
      except
    
      end;
    
    end;
    

    njoy :)