Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Set a cookie with ASP

Posted on 1998-11-18
2
Medium Priority
?
160 Views
Last Modified: 2010-05-03
I need code that can set a cookie that will stay if the user is using Netscape or MSIE.
0
Comment
Question by:jfl
2 Comments
 

Accepted Solution

by:
MrOBrian earned 40 total points
ID: 1445391
How to set a cookie:

Response.Cookie("mycookie") = "this is the text..."
Response.Cookie("mycookie").Expires = "January 1, 1999"

Pulling this right out of a book...  You should be able to set the Expiration date to whatever you want, assuming y2k compliance.  "mycookie" can be changed to whatever variable you want to save it as, the first line can only contain text, and I think that the expiration date has to be in the above format...
Another way to do cookies with ASP is with server variables, but they expire when the session ends.  If you don't use session variables (this is something I didn't know...) you can put in:
<%@ EnableSessionState=False %>
as the first line of your ASP code to get a performance boost.
0
 

Author Comment

by:jfl
ID: 1445392
I can not make it work in both IE and Netscape. Can you?
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

963 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