0

I want my cookies expire after an hour. I'm doing it in classic asp and I am a newbie.

I have tried this;

Response.Cookies("NumVisits").Expires=dateadd("h", 1, now())

but it's not working.

user692942
  • 16,398
  • 7
  • 76
  • 175
user3391775
  • 1
  • 1
  • 1

2 Answers2

1

it works fine for me

Response.Cookies("NumVisits").expires = dateadd("n",+60,now())
Boopathi Rajan
  • 1,212
  • 15
  • 38
  • still never work for me. Here is my full code <% dim numvisits Response.Cookies("NumVisits").expires = dateadd("n",+60,now()) numvisits=request.cookies("NumVisits") %> <% if numvisits="" then response.cookies("NumVisits")=1 else %> <% end if %> – user3391775 Mar 07 '14 at 09:17
0

Change your code to the following:

<% 
dim numvisits 
numvisits = 40 'Get the number of visits
Response.Cookies("NumVisits") = numvisits
Response.Cookies("NumVisits").expires = dateadd("n",+60,now())
%> 
<body>
<% if numvisits= "" then 
   Response.Cookies("NumVisits")=1 
   else %>
<script> 
$(function() { 
    $('button,input[type=submit]').attr('disabled',true); 
});  
</script>
<% end if %> 
<button>hello</button> 
</body>
meda
  • 45,103
  • 14
  • 92
  • 122