473,799 Members | 3,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Cookie s.Add(new HttpCookie(Requ est.Url.Absolut eUri+"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.locati on are identical.

Many Thanks
Robin
Nov 18 '05 #1
0 1944

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

Similar topics

3
1482
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
1651
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 controls, since it has the attribute runat="server", so the controls will be processed in web server?? Do you think the processing time will be slower than tradiational ASP applications?? I guess the fundamental question is when do we use...
1
3349
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 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
7
3215
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 think the username can be read with user.identity.name.
0
1646
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 rendering time to provide a total "user experience" time. An example of where it might be used would be on a search page that allows a user to enter some text and click a search button. I would like to track from the time the user clicked the...
6
9535
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 to a link if possible. Thanks, Dinoo
13
2117
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, and just indexed to the session token data?
2
4413
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 is successful Response.Buffer = True Response.Cookies(strAppRoot).Domain = strHelpdeskServer
35
315
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 using Perl on the backend, with Javascript providing limited frontend functionality. As an example, an expanding tree would be fully populated on the server-side and then presented to the browser, with Javascript and CSS being used to vary the...
0
9541
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
10485
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10027
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
9073
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
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
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
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

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.