473,324 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

A Cookie Error is a Sometimes Thing

Hi,

I've a script that sets a cookie, but when I visit the page occasionally
get this error that goes away when I immediately refresh the page:

"Object doesn't support this property or method:
'Response.Cookies(...)"
Here's the code in question:

Response.Cookies("CKName")("ED").Expires = DATE + 3650
I've read elsewhere that the ".Expires" method is not supported, but
it's in most of the online cookie tutorials I've looked at, and, like I
said, it works when I refresh the page.

I also saw a comment on this board that this is not how you create a
permanent cookie with ASP. If not, then how?
Thanks.
Sep 14 '07 #1
2 3198
"Pupkin" <sp*******@dorrk.comwrote in message
news:MP***********************@news.giganews.com.. .
Hi,

I've a script that sets a cookie, but when I visit the page occasionally
get this error that goes away when I immediately refresh the page:

"Object doesn't support this property or method:
'Response.Cookies(...)"
Here's the code in question:

Response.Cookies("CKName")("ED").Expires = DATE + 3650
I've read elsewhere that the ".Expires" method is not supported, but
it's in most of the online cookie tutorials I've looked at, and, like I
said, it works when I refresh the page.

I also saw a comment on this board that this is not how you create a
permanent cookie with ASP. If not, then how?

The cookie is the object retrevied with Cookies("CKName"). ("ED") is a value
with in the cookie and returns a string.
Cookies can be multivalued which what you appear to be using but you can
only expire the cookie as whole not an individual value. This code should
perhaps be:-

Response.Cookies("CKName").Expires = Date + 3650
--
Anthony Jones - MVP ASP/ASP.NET
..
Sep 14 '07 #2
In article <#1**************@TK2MSFTNGP03.phx.gbl>, An*@yadayadayada.com
says...
"Pupkin" <sp*******@dorrk.comwrote in message
news:MP***********************@news.giganews.com.. .
Hi,

I've a script that sets a cookie, but when I visit the page occasionally
get this error that goes away when I immediately refresh the page:

"Object doesn't support this property or method:
'Response.Cookies(...)"
Here's the code in question:

Response.Cookies("CKName")("ED").Expires = DATE + 3650
I've read elsewhere that the ".Expires" method is not supported, but
it's in most of the online cookie tutorials I've looked at, and, like I
said, it works when I refresh the page.

I also saw a comment on this board that this is not how you create a
permanent cookie with ASP. If not, then how?


The cookie is the object retrevied with Cookies("CKName"). ("ED") is a value
with in the cookie and returns a string.
Cookies can be multivalued which what you appear to be using but you can
only expire the cookie as whole not an individual value. This code should
perhaps be:-

Response.Cookies("CKName").Expires = Date + 3650

Great. That makes a lot of sense. Thanks!
Sep 14 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Jochen Daum | last post by:
Hi! I have a function in a lot of pages, which redirects to a new page, if a form has been submitted: if (!(defined("DEBUG_INSERT") && DEBUG_INSERT) && !(defined("DEBUG_UPDATE") &&...
1
by: Romain Perin | last post by:
Hi, I've been testing using session and it worked fine on my local machine, but when i put it on a distant server i get this error: Cannot send session cookie - headers already sent by (output...
4
by: Resant | last post by:
I have a scheduled job contain 2 steps. Step 1 is execute DTS Package using CmdExec 'DTSRun', step 2 using TSQL to execute just simple query. This job execute recurely every day, every 6 hours....
9
by: Peter Oliphant | last post by:
For some reson my code is generating a LNK1215 error, which 'suggests' I re-install VS C++. So I did. which did NOT solve the problem. The weid part is it seems to be caused by my one CPP file, but...
4
by: Ersin Gençtürk | last post by:
Server : WEB System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Web.HttpException: The View State is invalid for this page and might be...
0
by: Bantha | last post by:
I keep getting thei error and can fin out why Response is not available in this context. Description: An unhandled exception occurred during the execution of the current web request. Please...
0
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS 2005, .net 2 and C# for a windows application. Let's say I'm running from loggin into a domain controller DC1. I have a treeview and nodes representing a DirectoryEntry object. ...
1
by: Bobby Edward | last post by:
Here's my code... Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Request.Cookies("UserSettings")("IsAdmin") Is Nothing Then ' THIS IS LINE...
5
by: munkee | last post by:
Hi all, I am using a form to basically display monthly and fiscal year to date figures. I use the following code in the submit button (combo boxes populare year, month, department and incident...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.