Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 811859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:06:38+00:00 2026-05-15T01:06:38+00:00

How do I set the HTTPOnly flag? the TCookie does not have any method

  • 0

How do I set the HTTPOnly flag?
the TCookie does not have any method or property to specify the HTTPOnly flag.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:06:38+00:00Added an answer on May 15, 2026 at 1:06 am

    If you talking about TCookie in HttpApp.pas then there is no built in property to support HttpOnly.

    You can look at httpApp.pas at the TCookie.GetHeaderValue: string; implementation to verify.

    However a Cookie is just something set in the Header and TWebResponse has a CustomHeaders
    property. Where you could Call Response.CustomHeaders.Add(MyCookieValue);

    The following class is a modified version of TCookie to support HttpOnly that you can use to generate the cookie correctly.

    unit CookieGen;
    
    interface
    uses
     Sysutils,Classes,HttpApp;
    type
      TCookieGenerator = class(TObject)
      private
        FName: string;
        FValue: string;
        FPath: string;
        FDomain: string;
        FExpires: TDateTime;
        FSecure: Boolean;
        FHttpOnly: Boolean;
      protected
        function GetHeaderValue: string;
      public
        property Name: string read FName write FName;
        property Value: string read FValue write FValue;
        property Domain: string read FDomain write FDomain;
        property Path: string read FPath write FPath;
        property Expires: TDateTime read FExpires write FExpires;
        property Secure: Boolean read FSecure write FSecure;
        property HttpOnly : Boolean read FHttpOnly write FHttpOnly;
        property HeaderValue: string read GetHeaderValue;
      end;
    
    implementation
    
    { TCookieGenerator }
    
    function TCookieGenerator.GetHeaderValue: string;
    begin
      Result := Format('%s=%s; ', [HTTPEncode(FName), HTTPEncode(FValue)]);
      if Domain <> '' then
        Result := Result + Format('domain=%s; ', [Domain]);  { do not localize }
      if Path <> '' then
        Result := Result + Format('path=%s; ', [Path]);      { do not localize }
      if Expires > -1 then
        Result := Result +
          Format(FormatDateTime('"expires="' + sDateFormat + ' "GMT; "', Expires),  { do not localize }
            [DayOfWeekStr(Expires), MonthStr(Expires)]);
      if Secure then Result := Result + 'secure; ';  { do not localize }
      if HttpOnly then Result := Result + 'HttpOnly';  { do not localize }
      if Copy(Result, Length(Result) - 1, MaxInt) = '; ' then
        SetLength(Result, Length(Result) - 2);
    
    end;
    
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

By default, Glassfish v3 doesn't set the httpOnly flag on session cookies (when created
set batVar_Parameters=/Developer /Test=0 if not '%batVar_Iteration%' equ '-1' ( set batVar_Parameters=%batVar_Parameters% /Iteration=%batVar_Iteration% ) if
I have a set of C# Selenium tests that need to delete a cookie
In Ruby on Rails, how do I set the session cookie's httpOnly setting to
I have a cookie which is set when a user accesses the page /auth/
In Servlet 3.0 complaint application servers I can set the HttpOnly and secure flags
I have a slight confusion regarding HTTPOnly attribute in cookies. I am aware that
I'd like to know how to set cookies as HTTPOnly in Codeigniter. I reviewed
Or maybe i am doing it wrong, why are the cookies not being set
I have a site, e.g. example.com , where users can set their own subdomains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.