473,383 Members | 1,952 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,383 software developers and data experts.

Checking for existence of a cookie

I tried to post this last week, but never saw it, so I hope it's not a
duplicate. (Sorry if it is.)

I am rewriting our member log-in page in classic ASP from PHP. We will be
switching platforms next month. Every member has an access number to log in.
Once they have logged in, if they accept it, a cookie is provided so they do
not have to log in again. When the code is supplied via the cookie or form,
it is validated against a database file to determine the level (customer,
distributor, etc.) and the page is built accordingly. If the code has been
inactivated or is no longer valid, appropriate messages are supplied. Pretty
basic stuff.

The first thing I want to do is to check if the cooky exists on the client
computer. PHP had code for this, but I'm not sure I'm doing it correctly in
classic ASP. My opening code is below. This is before any HTML on the page,
as I have to determine if cookeis need to be set or deleted before the page
opens. When I run this on my IIS server here, the page displays an error 500,
but no hints as to what line the error is in. Can anyone help. I suspect it
is because at this state, the cookie does not exist, as it is my first
log-in. Thanks in advance.

If Request.Cookies("kc").HasKeys Then
bCooky = "S" 'Cookie exists, set flag for cooky set
strCode = Request.Cookies("code")
strSource = "cookie"
ElseIf Not IsEmpty(Request.Form("code")) And Not
IsEmpty(Request.Form("submit")) Then
strCode = Request.Form("code")
strSetCooky = Request.Form("cooky")
strSource = "form"
End If
--
Gail S
Gent-l-kleen Products, Inc.
York, PA
Jun 27 '08 #1
2 3776
GailS wrote:
I tried to post this last week, but never saw it, so I hope it's not a
duplicate. (Sorry if it is.)

I am rewriting our member log-in page in classic ASP from PHP. We
will be switching platforms next month. Every member has an access
number to log in. Once they have logged in, if they accept it, a
cookie is provided so they do not have to log in again. When the code
is supplied via the cookie or form, it is validated against a
database file to determine the level (customer, distributor, etc.)
and the page is built accordingly. If the code has been inactivated
or is no longer valid, appropriate messages are supplied. Pretty
basic stuff.

The first thing I want to do is to check if the cooky exists on the
client computer. PHP had code for this, but I'm not sure I'm doing it
correctly in classic ASP. My opening code is below. This is before
any HTML on the page, as I have to determine if cookeis need to be
set or deleted before the page opens. When I run this on my IIS
server here, the page displays an error 500, but no hints as to what
line the error is in.
The first thing you have to do is determine what the real error is:
http://www.aspfaq.com/show.asp?id=2109

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jun 27 '08 #2

--
Gail S
Gent-l-kleen Products, Inc.
York, PA
"Bob Barrows [MVP]" wrote:
GailS wrote:
I tried to post this last week, but never saw it, so I hope it's not a
duplicate. (Sorry if it is.)

I am rewriting our member log-in page in classic ASP from PHP. We
will be switching platforms next month. Every member has an access
number to log in. Once they have logged in, if they accept it, a
cookie is provided so they do not have to log in again. When the code
is supplied via the cookie or form, it is validated against a
database file to determine the level (customer, distributor, etc.)
and the page is built accordingly. If the code has been inactivated
or is no longer valid, appropriate messages are supplied. Pretty
basic stuff.

The first thing I want to do is to check if the cooky exists on the
client computer. PHP had code for this, but I'm not sure I'm doing it
correctly in classic ASP. My opening code is below. This is before
any HTML on the page, as I have to determine if cookeis need to be
set or deleted before the page opens. When I run this on my IIS
server here, the page displays an error 500, but no hints as to what
line the error is in.

The first thing you have to do is determine what the real error is:
http://www.aspfaq.com/show.asp?id=2109

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob,

Many thanks! When I started working with ASP two years ago, I got the
detailed script errors, which were very helpful. But I was unable to continue
that work for some time now. The IE setting must have been reset with the
last version upgrade, as now I have my debugging notes back. It's not the
cooky line, silly me forgot to remove a directory reference for an included
file. OOPS! Again, thanks so much!

Gail
Jun 27 '08 #3

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

Similar topics

4
by: GujuBoy | last post by:
i want to check to see if a certain program is installed on my windows box using python. how can i do that...(ie, i want to see if "word" is installed) please help
1
by: Alistair | last post by:
hi folks (and folkesses) is it possible to create a session cookie and then test for the existence of that session cookie on another page? basically, what I'm trying to do is a sort of buddy...
0
by: Lucifer | last post by:
Hi I have some code for checking for cookies, that sets a cookie on page1 and checks for it on page2. and its based on the code by MS: ...
1
by: Xeno Campanoli | last post by:
I'm having a hard time checking existence of windows. The only thing I found on this is page 224 of Rhino. Why is there no function to check this? Is there a publication on this part of the...
4
by: Christopher Nelson | last post by:
I have a multi-page site that I want to be able to resume at the same page if the user leaves and comes back later (say, days later). I'm thinking that I'll set a cookie as each page is displayed...
2
by: mike | last post by:
I had a form like below that validated that a file was there before it would submit. <form name="attach" method="POST" action="run_this_pgm.cfm" enctype="multipart/form-data"...
5
by: Richard L Rosenheim | last post by:
What's the proper technique for checking for the existence of an attribute within a node? Lets say I did a SelectSingleNode which returned this element: <AnAddress city="San Francisco"...
1
by: Tina | last post by:
When I use Request.Browser.Cookies I always get true returned. Even when the browser has cookie acceptance turned off. Why? Thanks, T
4
by: Patient Guy | last post by:
Does anyone have any coding rules they follow when doing argument checking? When arguments fail during check, do you return from the call with an ambiguous return value, or do you throw...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.