473,802 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cookie's Expiration property unexpectedly changing

Here's the code:

Private Sub SetCookie(ByVal tcEmail As String)
Dim loCookie As New HttpCookie("Ema il")
loCookie.Value = Utils.StringToB ase64(tcEmail)
loCookie.Expire s = Now.AddYears(10 )
Response.Cookie s.Add(loCookie)
End Sub

The cookie appears to accept the specified expiration date (i.e. #7/13/2015
10:18:21 PM#) just fine, but when I read the cookie in a new browser session its
Expiration property returns simply #12:00:00 AM#.

What happened to the date portion, and more importantly how can I get it back? I
need it so I can do calculations elsewhere in my code.

Many TIA for any suggestions,
Jeff

Nov 19 '05 #1
2 1937
OK, after a bit of a break to step away and clear my head a bit, I've concluded
that the value of a cookie's Expiration property isn't intended to be used in
any sort of server-side computation--it's for the browser's internal use only.

Armed with this new way of looking at things, I only had to change the way I was
doing my calculation. All is well now, and I can go to bed and rest peacefully.

Thanks for your ear!

Jeff

Jeff Bowman wrote:
Here's the code:

Private Sub SetCookie(ByVal tcEmail As String)
Dim loCookie As New HttpCookie("Ema il")
loCookie.Value = Utils.StringToB ase64(tcEmail)
loCookie.Expire s = Now.AddYears(10 )
Response.Cookie s.Add(loCookie)
End Sub

The cookie appears to accept the specified expiration date (i.e. #7/13/2015
10:18:21 PM#) just fine, but when I read the cookie in a new browser session
its Expiration property returns simply #12:00:00 AM#.

What happened to the date portion, and more importantly how can I get it
back? I need it so I can do calculations elsewhere in my code.

Many TIA for any suggestions,
Jeff

Nov 19 '05 #2

The cookie appears to accept the specified expiration date (i.e. #7/13/2015
10:18:21 PM#) just fine, but when I read the cookie in a new browser session
its
Expiration property returns simply #12:00:00 AM#.

What happened to the date portion, and more importantly how can I get it
back? I
need it so I can do calculations elsewhere in my code.

Many TIA for any suggestions,

"Jeff Bowman" <wr*********@my .addess.com> wrote in message
news:%2******** **********@TK2M SFTNGP14.phx.gb l...
Here's the code:

Private Sub SetCookie(ByVal tcEmail As String)
Dim loCookie As New HttpCookie("Ema il")
loCookie.Value = Utils.StringToB ase64(tcEmail)
loCookie.Expire s = Now.AddYears(10 )
Response.Cookie s.Add(loCookie)
End Sub

The cookie appears to accept the specified expiration date (i.e. #7/13/2015 10:18:21 PM#) just fine, but when I read the cookie in a new browser session its Expiration property returns simply #12:00:00 AM#.

What happened to the date portion, and more importantly how can I get it back? I need it so I can do calculations elsewhere in my code.

Many TIA for any suggestions,
Jeff


_______________ _______________ _______________ _______________ _______________ ____
Posted Via Uncensored-News.Com - Accounts Starting At $6.95 - http://www.uncensored-news.com
<><><><><><>< > The Worlds Uncensored News Source <><><><><><><>< >

Nov 19 '05 #3

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

Similar topics

7
2148
by: Christoph Pieper | last post by:
Hi, we've the following problem : We have an asp-application which sets the cookie on first login. The cookie will never be touched during user access. The user can work the whole day, but after 6 to 7 hours, the cookie get 2-4 new asp-sessionid's thus overwriting the very first entries in the cookie. Does anyone had the same problem or has a solution. The server is a w2003 enterprise the client has windows xp sp2.
15
3653
by: Oleg Leikin | last post by:
Hi, (newbie question) I've created some simple .NET ASP application that should store cookies at the client machine. According to the documentation cookie expiration time is set via HttpCookie.Expires property, but property value is the time of day on the client. How can I possibly know client local time ?
0
1897
by: Kepler | last post by:
I'm testing very basic FormsAuthentication and having trouble with non-persistent cookies. Once authenticated with a non-persistent cookie, if I leave the browser alone for 30 minutes, Request.IsAuthenticated returns false on my next request. WHY? At first I thought it had to do with session timeout, but session timeout is set to 20 minutes, and I'm still authenticated after 20 minutes. Thirty minutes is the magic number. I'm at a loss...
2
1883
by: Bill Borg | last post by:
Hello all, I am working on forms authentication and trying to understand: what's the relationship between the cookie expiration and the ticket expiration? I create a cookie and I add an encrypted ticket to it. Both of these have an expiration date, but I'm not seeing how to use them. Does it make sense that these dates would ever differ? Thanks,
15
2151
by: Edwin Knoppert | last post by:
I have searched but info is limitted. In my test app i used a non persistant cookie for forms authentication. slidingExpiration is set to true On run and close and rerun the login remains ok. I have a time-out of one minute and indeed, it directs me to the login if i wait to long. The slidingExpiration does it's work also.
9
5523
by: Mike Reed | last post by:
I must be having a "senile" day! I cannot recall, nor get to work, code to read a cookie's expiration date/time in an ASP page/VBScript. What am I missing? *** Sent via Developersdex http://www.developersdex.com ***
0
1118
by: Laura K | last post by:
I am working with a shopping cart (I am suing a book). At this point I am trying to add the cartID, the productID, quantity and time. At the same time it is supposed to add a cookie. When I click the add to cart button it gives me a postback but does not enter data in the database or add the cookie. I have tried to work with permissions. Since it is on my local machine I have added permission to everything I can think of. Here is the...
5
2229
by: SJ | last post by:
Hi, In my website, i have a cookie that allows the user to remain logged in for upto 90days. So I'm setting the cookie expiration time to 90 days in the future from the time the user logs in. I've been testing my code and for some reason, the cookie expires randomly before even 24 hrs has passed. Yesterday it expired after 11hrs and 20mins. Any idea why my cookie expiration isn't working?
1
4473
by: Joe | last post by:
In ASP.NET 1.1 I could detected expired form authentication tickets (which closely coincide with my expired session) by checking for the Authentication Cookie when the login screen loads. If the cookie exists, then decrypt the forms auth. ticket and check to see if it is expired. If so display a message to the user letting them know why they are back on the login screen. The code I used was something like this: Dim cookie as HttpCookie...
0
9699
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
9562
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
10305
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
10285
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
10063
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2966
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.