473,811 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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").HasKe ys 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("c ode")
strSetCooky = Request.Form("c ooky")
strSource = "form"
End If
--
Gail S
Gent-l-kleen Products, Inc.
York, PA
Jun 27 '08 #1
2 3801
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
5153
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
1345
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 list. When someone logs in (lets say Dave) a session cookie (dave) is created, then along comes bob, when bob logs in, he could see that Dave is logged on because a test for session.cookie in Dave's name is true.
0
333
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: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchaspnetcookies101.asp under section: 'Checking Whether a Browser Accepts Cookies' This code works great, when its in my development enviroment.
1
1491
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 protocol I can read as a newbie? Please can someone make a suggestion one what to read or try? Sincerely, Xeno -- Community FIRST, Then Trade! http://www.eskimo.com/~xeno, xeno@eskimo.com, Xeno Campanoli
4
2432
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 and when the main/first page displays, I'll look for the cookie and open the page it names. If a new version of the site omits a page that used to exist or if the cookie somehow becomes corrupt, I don't want to display an error when I try to...
2
2044
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" onSubmit="return(validateData(this))"> <input type="file" name="txtFileToUpload"> <input type="submit" name="btnAdd" value="Add" class="form_button"> </form> function checkFile(frm)
5
19539
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" state="CA" /> What's the best why of determining if the attribute zipcode exists in this node? If I try accessing the attribute with code like: ZipCode = myNode.Attributes("zipcode").Value
1
1118
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
2394
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 exceptions?
0
9728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10648
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10402
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9205
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.