472,958 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 3187
"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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.