Solved

Classic ASP Cookie Error

Posted on 2010-08-26
2
385 Views
Last Modified: 2012-08-14
At least some of my website visitors (possibly all) are getting the following error when my script is setting the expiry date of a cookie.

It happens the first time a user calls the page, but if they refresh it works fine.

Microsoft VBScript runtime
Type mismatch: 'Response.Cookies'
/locale.asp, line 24

23: Response.Cookies("locale") = Session("locale")
24: Response.Cookies("locale").Expires = DateAdd("m", 6, Now())

I can reproduce the problem and if I view the cookie information in IE developer tools immediately after the error, that cookie exists and the expiry date is correct, ie. 6 months from today.
0
Comment
Question by:knobbylowboy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
Rajesh Dalmia earned 250 total points
ID: 33529709
you are assigning Session("locale") into Response.Cookies("locale")...
seems like for the 1st time Session("locale") does not exist....
during refresh that session gets created and thus does not give any error
0
 

Author Closing Comment

by:knobbylowboy
ID: 33529813
I thought that the error was due to the expiry line but I see that under some circumstances I was passing a null value from a database into the session variable and then passing that value to the cookie so I guess the cookie didn't exist when I tried to set the expiry date.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question