[Gambas-user] SetCookie/DeleteCookie

Hans Lehmann hans at gambas-buch.de
Mon Jan 4 16:37:21 CET 2021


Hello,

since my request to set a cookie from a WebPage did not find an answer 
so far, I present my source code in excerpts:

The class site.class contains among others this procedure:

Public Sub Set_Cookie()

   Dim dExpires As Date

   dExpires = DateAdd(Now(), gb.Minute, 30)
   Response.SetCookie("GBB", "Osterburg", "", "/", dExpires, True)

End

and here the content of the file site.webpage:

<!DOCTYPE html>
<html lang="de">
   <head>

*<%Set_Cookie%>*

     <title>DB-REPORT</title>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, 
initial-scale=1.0, shrink-to-fit=no">
     <link rel="stylesheet" type="text/css" href="css/style.css">
     <link rel="shortcut icon" type="image/x-icon" 
href="favicon/favicon_blue.ico">
     <script src="js/time.js" charset="utf-8"></script>
   </head>
   <body onload="startTime()">
     <div class=header0>
       <h1>Aktuelle Zeit: </h1><h1 id="current_time"></h1>
     </div>
     <br>
     <% PrintDBTable() %>
   </body>
</html>


Unfortunately no cookie is set. Therefore the question: Where is the error?

With kind regards

Hans


More information about the User mailing list