473,473 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

all cookies disappear after round trip to client

Hi,

I have a web app, there is only really 1 aspx page (that the user never
sees) the rest of the code is done in a DLL that implements HttpHandler.
My app (which is a porting job from Vb6 webclasses) needs to use session
cookies (i.e. when all browser windows are closed the cookies disappear)
however in my code the cookies disappear after a round trip to the client
browser, i.e:

Browser
|
- request
|
web server - does code, sets cookies
|
- response
|
Browser
|
- request
|
web server - checks cookie set from 1st request *&%!!"- they are all gone.

I have an asp wrapper class that has a member variable of type Httpcontext
this gives me access to all the asp objects like request etc...
I have a property ClientVars() which wraps up the cookie access. What
ClientVars() does to set a cookie is this:

m_context.Response.Cookies(m_strCookieName)(strNam e) = Value

And I get the cookie (after a decision) with either:

m_context.Response.Cookies(m_strCookieName)(strNam e)
or
m_context.Request.Cookies(m_strCookieName)(strName )

The reason for the above decision in the get bit is so that if I set a
cookie and then in the same request ask for the cookie again it will give it
me from the response instead of the request.

m_strCookieName gets set when the my asp wrapper class is initialised to the
path from URL, i.e. if my url was http://localhost/testVersion, then
m_strCookieName would be "testVersion", if the url was http://localhost it
would be an empty string.

The pages that the user gets includes JS that creates a cookieJar (from the
O'Reily JS books), but the cookies I am interested in on the 2nd request are
not touched my the JS cookieJar stuff in terms of setting, and even if they
were my .NET code should still be able to see the ones it initially set.

One curious thing that I do see on the 2nd request (side effect of JS
perhaps?) is that in the Request.Cookies.AllKeys collection (given the
example URL above) there are now 2 keys called "testVersion" whereas during
the 1st request there was only one. If I access either of them using there
index values:

? m_context.Request.Cookies(1)(0)
or
? m_context.Request.Cookies(3)(0)

The cookies in between index 1 and 3 are things like ASP__SESSION or
similar, which I don't use and didn't set.

....respectively then each returns Nothing, so all my cookies set in 1st
request have disappeared.

Any help working out where these cookies are going would be highly
appreciated.

Regards,
Peter Row
Nov 18 '05 #1
1 3324
This link may help

http://www.codeproject.com/aspnet/aspnetcookies.asp

"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,

I have a web app, there is only really 1 aspx page (that the user never
sees) the rest of the code is done in a DLL that implements HttpHandler.
My app (which is a porting job from Vb6 webclasses) needs to use session
cookies (i.e. when all browser windows are closed the cookies disappear)
however in my code the cookies disappear after a round trip to the client
browser, i.e:

Browser
|
- request
|
web server - does code, sets cookies
|
- response
|
Browser
|
- request
|
web server - checks cookie set from 1st request *&%!!"- they are all gone.

I have an asp wrapper class that has a member variable of type Httpcontext
this gives me access to all the asp objects like request etc...
I have a property ClientVars() which wraps up the cookie access. What
ClientVars() does to set a cookie is this:

m_context.Response.Cookies(m_strCookieName)(strNam e) = Value

And I get the cookie (after a decision) with either:

m_context.Response.Cookies(m_strCookieName)(strNam e)
or
m_context.Request.Cookies(m_strCookieName)(strName )

The reason for the above decision in the get bit is so that if I set a
cookie and then in the same request ask for the cookie again it will give it me from the response instead of the request.

m_strCookieName gets set when the my asp wrapper class is initialised to the path from URL, i.e. if my url was http://localhost/testVersion, then
m_strCookieName would be "testVersion", if the url was http://localhost it
would be an empty string.

The pages that the user gets includes JS that creates a cookieJar (from the O'Reily JS books), but the cookies I am interested in on the 2nd request are not touched my the JS cookieJar stuff in terms of setting, and even if they were my .NET code should still be able to see the ones it initially set.

One curious thing that I do see on the 2nd request (side effect of JS
perhaps?) is that in the Request.Cookies.AllKeys collection (given the
example URL above) there are now 2 keys called "testVersion" whereas during the 1st request there was only one. If I access either of them using there
index values:

? m_context.Request.Cookies(1)(0)
or
? m_context.Request.Cookies(3)(0)

The cookies in between index 1 and 3 are things like ASP__SESSION or
similar, which I don't use and didn't set.

...respectively then each returns Nothing, so all my cookies set in 1st
request have disappeared.

Any help working out where these cookies are going would be highly
appreciated.

Regards,
Peter Row

Nov 18 '05 #2

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

Similar topics

20
by: Brian Burgess | last post by:
Hi all, Anyone know if this is possible? If so, on which page would the cookie be? .. On the page calling a function defined in the include file? thanks in advance.. -BB
0
by: charliewest | last post by:
I am using a data grid control to present info on an ASP.NET web form. When clicking buttons, i can show or hide columns and rows, however, this requires a round-trip back to the server. Is...
2
by: Homer J. Simpson | last post by:
Hi there, I need to maintain users choices among different sessions. So i'd like to use a kind of server-side cookies, just to be sure he won't delete or reject the cookie, depending on the...
2
by: Yanir | last post by:
H I have to display a sortable list of columns(a table or so) - by click on the title of a column, the column would be the criteria to sort by I know datagrid is very conveniant, but I want to save...
2
by: Mike | last post by:
Hello, I have a web user control that contains a ListBox. I would like to display some information based on the double-clicking of the user on a ListBox's item. I was thinking about some code...
4
by: Steve Commisso | last post by:
I'm working with the following scenario: I'm building a wizard. Each 'step' of the wizard is its own User Control page. I'm trying to minimize the 'round trips' (e.g. runat=server) I make to the...
3
by: Calvin KD | last post by:
Hi everyone, Can someone tell me what's wrong with the way that i read a cookie as below: private void Page_Load(object sender, System.EventArgs e) { Response.Cookies.Clear(); HttpCookie...
8
by: needin4mation | last post by:
I understand this is a asp.net group, but thought I would post this here for comments. I admit I have used this post in another group, but it has less traffic. Here's to hoping I'm just blind to...
7
by: Tony Girgenti | last post by:
Hello. I'm trying to undetrstand ASP.NET 2.0 and javascript. When i have a button and i click on it and i see the web broswer progress bar at the bottom do something, does that mean that there...
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...
0
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,...
0
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,...
0
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...
0
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.