Solved

Classic ASP Cookie Error

Posted on 2010-08-26
2
379 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
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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 video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

838 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