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

Cookie Trouble --> disappearing

I have 2 pages... in the first page i check to see for
the existance of the cookie, if found do something else
set the value and set the cookie.
(cookie gets set ok)

I use the following code to read and write the cookie..
READ..
Dim stmp As String
Dim c As HttpCookie =
HttpContext.Current.Request.Cookies("HD")
If Not c Is Nothing Then
stmp = c(Key)
Else
stmp = ""
End If
Return stmp

WRITE
Dim c As New HttpCookie("HD")
c("DialogTypeID") = DialogTypeID.ToString
c.Expires = DateTime.Now.AddYears(1)
HttpContext.Current.Response.Cookies.Add(c)

Now i navigate to a second page which looks for a cookie
of a differnt name and reads the value. The following
code...

Dim stmp As String
Dim c As HttpCookie =
HttpContext.Current.Request.Cookies("HD2")
If Not c Is Nothing Then
stmp = c(Key)
Else
stmp = ""
End If
Return stmp

Now when i navigate back to the first page the first
cookie is gone. I look in my localhost cookies and it is
no longer in the cookie file. PLEASE tell me what is
going on.

please.
thank you in advance...

dave
Nov 17 '05 #1
2 1585
Hi,

if you dont set any of the cookies properties (Domain,Expires...) the
default is that cookie will be available for the current page. if you
navigate to other page the cookie die. when you use the Back button the
browser use cache version of the page. no call is made to the server so
no new cookie creat and the old one already vanished.

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #2
DId you also "write" cookies in the second web form? Additionally, when
will you write the cookies, after find that stmp is empty?

Luke

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 17 '05 #3

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

Similar topics

1
by: Sergio | last post by:
<HTML> <!- I need to write code that saves contents of the following form as MyForm.txt(only Last_Name,First_Name) into directory c:\MyPATH\MyForm.txt or into cookies directory. -->...
0
by: pwldev | last post by:
Sorry if this isn't a good place for this question. I have a problem with losing cookie values whenever a user's local machine date/time is behind the date & time of the IIS machine. The login...
1
by: Steve Remer | last post by:
My application (relevant code snippets below) originally used Session variables in order to maintain state from page to page. After being unable to solve the mystery of why those variables were...
2
by: Raterus | last post by:
Howdy, I have one IIS Application, with asp/asp.net pages. I set a cookie like so in an ASP page. Response.Cookies("AuthCookie")("hash") = md5(username & Application("HashCode"))...
2
by: | last post by:
While I was learning about baking cookies in ASP.NET, I also ran across this interesting article that outlined a few bombs to watch out for when using cookies in ASP.NET: ...
2
by: Owen | last post by:
I have a web app that is a mixture of ASP and ASP.NET pages. Largely the only data passed between them is via the querystring, or by reading from a database. However there is a requirement for...
3
by: Kevin Blount | last post by:
I've created a quick set of test scripts, and I'm finding that cookies don't work as I would expect(i.e. the same as they do in original ASP. In original ASP I could set a cookie on one page, set...
3
by: insomniac | last post by:
Hello, I'm not a newbie to cookies, however I am stumpped by a receent issue that has come up. I am running my web application through a frame that belongs to another company. This application...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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.