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

Client and Server Side Cookies

I have a page that contains some dhtml and uses client side cookies so store
it's current state so that on clicking the "back" button to it the page will
be as the user last saw it.
However, should the user click on a link to that page, I want to remove the
cookie so that the page is displayed in its default state.
The two ways I can think of doing this is to either have some javascript
code to delete the cookie when the page is first loaded (I do not know how
to do this)
Or, to remove or clear the cookie on the server side Page_Load event which
will only run on a refresh or load of the page.
I am having troubles getting this version to work though.

To write the cookie on the client side, I am using

document.cookie=document.URL + 'State' + '=' + pageState + ';';

The pageState var stores information about how the page should be rendered.
This cookie is read in javascript at the end of the page to reset all the
dhtml to the state in the cookie.

In my Page_Load event on the server side, I have the following code.

Response.Cookies.Add(new HttpCookie(Request.Url.AbsoluteUri+"State", ""));

If anyone can shed any light on why this may not be working that would be
very appreciated. I realise using the Url as the cookie name may not be the
best option but there are no query strings, so the absolute uri and the
document.location are identical.

Many Thanks
Robin
Nov 18 '05 #1
0 1921

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

Similar topics

3
by: Pål Johansen | last post by:
Is it possible to cache portions of a page client side. I have som include pages that I would like to store at the clients cache.
2
by: Matt | last post by:
I guess the principal differences between client-side and server-side code is that client-side code is processed in web browser, and server-side code is processed in web server. In ASP.NET web...
1
by: Peter Row | last post by:
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...
7
by: lvpaul | last post by:
Hallo ! I am using IIS-Windows-Authentication in my intranet (web.config <authentication mode="Windows" /> <identity impersonate="true" /> How can I get the users (client) IP-Address ? I...
0
by: brianpmccullough | last post by:
Hello, Anyone ever implemented a solution that allows you to track the total page request time in and ASP.NET page? The time would need to include the server processing time and client side...
6
by: dinoo | last post by:
Hi, I would appreciate if some one could help me out. I have to read a client side ini file in Aspx page and use that data in server side processing. Can any one help me out here? Please refer...
13
by: Sanders Kaufman | last post by:
When you have a session going, I know that PHP stores a session token on the client, but does it keep the session *data* on the client, as well? Or is the session data being stored on the server,...
2
by: Hannibal | last post by:
Hi All, The below code use to work on my Win2K3 IIS6. for for some unknown reason it`s no longer working. here the code. Session("LOGIN_USER_ID") = UserID ' Update the cookie if the login...
35
by: Dan Rumney | last post by:
Hi all, I've been writing Javascript for quite a while now and have, of late, been writing quite a lot of AJAX and AJAX-related code. In the main, my dynamically generated pages are created...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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...
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...

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.