473,326 Members | 2,076 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,326 software developers and data experts.

cookie test help needed

Hi. I read in some helpful publication

"If a cookie created by a page on catalog.acme.com sets its path attribute
to "/" and its domain attrinute to "acme.com", that cookie is available to
all web pages on catalog.acme.com or to any other server." (JavaScript The
Definitive Guide" O'Reilly)

This is exactly what I am trying to acheive. So I set about to test it.

I have a test server on my network. I went into my host file and pointed its
IP to stephie.com. I put up a little cookie write and read test on the
server. I ran the code with the machine name in the URL.

<machine name/CookieYesy/default.asp

sets the cookie then redirects to readcookie.asp.

The cookie is successfully written and read. The write code is:

Response.Cookies("MyID") = 123456
'Response.Cookies("MyID").Domain = "stephie.com"
Response.Redirect "readcookie.asp"
note that the line that sets the domain is commented out since I have not
gotten there yet. Just trying to write and read a cookie.

The readcookie.asp is:

<%
dim tst, tstdomain

tst = cstr(Request.Cookies("MyID"))
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<P>

<%
Response.Write "Cookie is: " & tst & "<BR>"


%>

</P>

</BODY>
</HTML>

When I run this by

http://<machine name>/CookieTest/default.asp

the write and read works great. When I do

http://stephie.com/CookieTest/default.asp

the code is run, the redirect occurs, but either the write or the read is
failing. The asp files are in teh same dir. I cannot see why this would be
happening.

Can anyone help me with Cookies 101? I have not even gotten to the point of
trying to read the cookie from the other machine I am going to set up on
plonk.stephie.com!

Thanks!!

S

Jul 19 '05 #1
3 1338
I am seeing the readcookie.asp page and

The cookie is

with no value.

Thanks

S
"Brad Simon" <an*******@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
Could you be a little more specific on this:

When I do

http://stephie.com/CookieTest/default.asp

the code is run, the redirect occurs, but either the write or the read is
failing. The asp files are in teh same dir. I cannot see why this would be
happening.

What are you seeing? What aren't you seeing?

Jul 19 '05 #2
Um. Er.

Thanks for your willingness to help.

It works fine when I prevent caching so that I am not seeing a previous
instance of running the read without having first executing the write.

Sorry for wasting your time.

S
"Stephanie Stowe" <st***@whackthisvsac.org> wrote in message
news:uG**************@TK2MSFTNGP10.phx.gbl...
I am seeing the readcookie.asp page and

The cookie is

with no value.

Thanks

S
"Brad Simon" <an*******@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
Could you be a little more specific on this:

When I do

http://stephie.com/CookieTest/default.asp

the code is run, the redirect occurs, but either the write or the read is failing. The asp files are in teh same dir. I cannot see why this would be happening.

What are you seeing? What aren't you seeing?


Jul 19 '05 #3
Ok, that helps out

A couple more questions. When you go to your cookies directory, do you see the both of the cookies? You may need to search for '@stephie.com' and '@localhost', and look inside the cookies to see if they look alike

If the cookies are there, you will want to put in a little code on the default.asp page, something like
response.write err.number & "<BR>Source: " & err.source & "<BR>Description: " & err.Description
response.en

put this in before your redirect. The page will not redirect, but you will have any error that may be occuring. If there is no error, then put that same code into the redirect page, and take it out of default.asp. See if that gives you any more information

Brad
Jul 19 '05 #4

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

Similar topics

16
by: Phil Powell | last post by:
Fourth attempt.. it fails now in login, I check by printing $_COOKIE and there is no value there! Guys, what on earth do I do about this???? Here is the code that sets the cookie: if...
6
by: Ajay | last post by:
hi! i am printing a simple cookie, but instead of printing um=name:blah&access:admin&exp:2312390.909 its printing um="name:blah&access:admin&exp:2312390.909" why the quotes?
12
by: George Hester | last post by:
I have always used this in ASP to test if the client is accepting cookies: <%@language="VBScript"%> <% Session ("nc") = 1 If Len(Session("nc")) = 0 Then 'Cookies Off Else 'Cookies On End If
3
by: F | last post by:
It seems that document.cookie doesn't work both on Internet Explorer 5 for Mac (OS 9) and Opera 6 for PC... am I doing something wrong? Or does it just not work? I don't get an error message, the...
0
by: Priya | last post by:
I am not able to read the cookie written through ASP from ASP.NET. I know I need to set the path of cookie correctly. When I set the path of my Cookie Response.Cookie("Test").Path = "/" in ASP...
5
by: Miljana | last post by:
Hi, I have one problem with cookies in ASP.NET application. It seems that I can not retreive cookie from Request.Cookies collection. I put cookie in Response.Cookies collection, and after page...
1
by: Aaron Fleming | last post by:
In classic ASP I have set a session variable, redirected to another page and requested the session variable. If it wasn't there ... redirect accordingly .. if so .. log in .. Is there a way to...
1
by: ticmanis | last post by:
Hello, I'm having trouble getting MSIE 6.0 (running on XP SP2) to accept a cookie which works fine in both Firefox and wget. The web server is Boa 0.94.13 (a small embedded server) using PHP...
6
by: peridian | last post by:
Hi, Been trying to get to the bottom of a bug, which I thought was the browsers fault, but it turns out is either: a) a bug in the browser. b) a bug in jquery cookie handler. c) a bug in MVC...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.