473,890 Members | 1,332 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

? Deleting All of My Site's Cookies / Using Wildcards With Cookie

Hi,

I'm using JavaScript and Cookies for some customization in a web page.
There may be several values in the cookie with names that are not known at
runtime. I need a way of deleting them.

For example, if my site is www.test.com and the cookie contains:

label1
fob
....
*

name1
foo
....
*
name2
bar
....
*
name3
baz
....
*

and so on, then I would write a function that simply deletes these values
with a loop that counts off name1, name2, name3, et cetera. Unfortunately
my cookie will use different labels, not name1, name2, name3..., in fact I
have no way of knowing exactly what they will be called beforehand although
they will have some things I can predict.

Can I use wildcards in the value-name, eg. in the above example, could I
delete "name*" or "*1"? Alternatively, is there a way to just delete ALL
values in the cookie?
Thanks.

--
news <.> alec <@> synetech <.> cjb <.> net
Jul 23 '05 #1
14 3298
Oh, and I know I have to set the value to expire to delete it. What I'm
looking for is a way to expire unknown values (names).
--
news <.> alec <@> synetech <.> cjb <.> net

Jul 23 '05 #2
Alec S. wrote:
Oh, and I know I have to set the value to expire to delete it. What I'm
looking for is a way to expire unknown values (names).


Set the expiration date on the cookie to a past date, the cookie will be
expired and it will be gone. Then, you reset the cookie with the data
you want.

--
Randy
Jul 23 '05 #3
Randy Webb wrote on 17 apr 2005 in comp.lang.javas cript:
Alec S. wrote:
Oh, and I know I have to set the value to expire to delete it. What I'm
looking for is a way to expire unknown values (names).


Set the expiration date on the cookie to a past date, the cookie will be
expired and it will be gone. Then, you reset the cookie with the data
you want.


You will have to trust the client time not being set in the past.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #4
Like I said, I already know how to delete a cookie-value whose name I know.
I need a way of deleting a cookie-value whose name I DON'T know.
--
news <.> alec <@> synetech <.> cjb <.> net
Jul 23 '05 #5
Alec S. wrote on 17 apr 2005 in comp.lang.javas cript:
Like I said, I already know how to delete a cookie-value whose name I
know.
This is usenet, please quote, if you are anwering someone.
I need a way of deleting a cookie-value whose name I DON'T know.


You should know their names since you set them.

=============== ==

With serverside ASP [sorry: vbs here] I can read them all:

Cookies Variables <br>
<% For each d in Request.Cookies %>
<%=d%>
=
<%=Request.Cook ies(d)%>
<br>
<% Next %>

And then set their content on "" and the expiry on 1 jan 1970

Serverside javascript goes about the same,
but with clientside javascript I doubt, if it is possible.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #6
> This is usenet, please quote, if you are anwering someone.

I didn't quote because I was replying to someone who replied to someone who
replied to me. Should I cut and paste multiple quotes, especially if they
are long? Most, if not all newsreaders these days display messages in a
"thread" which makes it easy enough to find the reference.

You should know their names since you set them.


Think about it this way. I have two text boxes in a form. The user enters
some text in them. I take that text from the first box and set a cookie
using that user-entered text as the name/label passing the text from the
second box as the value.

This isn't exactly the way I'm doing it but it's close enough to explain why
I don't know the name of the cookie. I need either a way of deleting all
cookies made at my site, simply deleting the whole cookie file associated
with my site, or some way of using wildcards—say for example if the user
must enter a username like 1234Blah where the 1234 is always the same and
the Blah is different.
--
news <.> alec <@> synetech <.> cjb <.> net
Jul 23 '05 #7
Alec S. wrote on 18 apr 2005 in comp.lang.javas cript:
This is usenet, please quote, if you are anwering someone.


I didn't quote because I was replying to someone who replied to
someone who replied to me. Should I cut and paste multiple quotes,
especially if they are long? Most, if not all newsreaders these days
display messages in a "thread" which makes it easy enough to find the
reference.


Please dont try to reinvent netiquette.
You should know their names since you set them.


Think about it this way. I have two text boxes in a form. The user
enters some text in them. I take that text from the first box and set
a cookie using that user-entered text as the name/label passing the
text from the second box as the value.

This isn't exactly the way I'm doing it but it's close enough to
explain why I don't know the name of the cookie.


Cookie handling is versatile enough not to be used this way

Strange you give so much room to these two sentences of mine
and do not address the real answer I gave.

Prossibly because you did not quote, you forgot that answer? ;-}

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #8
"Evertjan." <ex************ **@interxnl.net > wrote in message
news:Xn******** ************@19 4.109.133.29...
Randy Webb wrote on 17 apr 2005 in comp.lang.javas cript:
Alec S. wrote:
Oh, and I know I have to set the value to expire to delete it. What I'm looking for is a way to expire unknown values (names).


Set the expiration date on the cookie to a past date, the cookie will be
expired and it will be gone. Then, you reset the cookie with the data
you want.


You will have to trust the client time not being set in the past.


and
I need a way of deleting a cookie-value whose name I DON'T know.


You should know their names since you set them.

There, I quoted, adding a lot more text to download which is annoying for
dial-up users. I am not reinventing netiquette, but using guidelines that
many people—other than yourself—follow .
Either way, you did not help by saying that I should know the names nor by
saying that I need to trust the user's system clock. If you are feeling
hostile, judgmental, and critical and have no interest in helping then you
need not answer, I am sure there will be someone else who will give an
answer politely—and non-accusatorially— one way or another. It's so annoying
that there are grouchy people like you trolling everywhere.
--
news <.> alec <@> synetech <.> cjb <.> net
Jul 23 '05 #9
Alec S. wrote on 19 apr 2005 in comp.lang.javas cript:
Either way, you did not help by saying that I should know the names
nor by saying that I need to trust the user's system clock.


You will be the judge to if it helps you,
but both advises were made in an effort to help you.

The same goes for my final anwer to your OQ,
which you repeatedly forgot to address.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #10

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

Similar topics

2
3806
by: Aki Niimura | last post by:
Hello everyone, I have been trying to write a Python script to access a Web site. I'm currently having a problem completing my script because the contents I would like to access in the Web site is a dynamic content and it is generated based on the Cookie contents which are set in another page. url-a (setting Cookies) url-b (dynamic content based on the Cookie value)
1
5980
by: Michal A. Valasek | last post by:
Hello, I have problem deleting cookies and cookies values (using framework version 1.1 on W2003). When I try to remove entire cookie, by calling Response.Cookies.Remove("Test"), nothing happens, the cookie "Test" remains unchanged. When I try to remove one of cookie values, by calling
5
2261
by: Tony Pino | last post by:
Hi, Lets say there's a web site with simple authentication. It asks you to type a uname/password into a couple text boxes, and then it gives you a cookie and you're logged in for 20 minutes or so. What I need to do is automate that. In other words, in my code behind, how can I generate a POST request (with username and password data) to a server , get the cookie it returns, issue a request (using
2
2654
by: James | last post by:
Help! I've made a cookie with a key called 'List' and subkey 'item3' and assigned it a value of "3" Response.Cookies("List")("item3")="3" How do I now delete the subkey "item3" without deleting any other subkeys that might be in 'List'???
4
5169
by: macro | last post by:
when I use HttpWebRequest with CookieContainer object that handles cookies, if I have this cookie header in a response: Set-Cookie: CookieName=; path=/;expires=01-Jan-1999 00:00:00 GMT the cookie is not deleted for the next request, what should be and actually done with Internet Explorer as client. is this a bug is there a solution / workaroung by manually deleting the cookie?
4
2013
by: macro | last post by:
when I use HttpWebRequest with CookieContainer object that handles cookies, i make more than one request and needs to handle cookies being added and removed between requests, just like a regular web browser like internet explorer. if I have this cookie header in a response: Set-Cookie: <CookieName>=; path=/;expires=01-Jan-1999 00:00:00 GMT the cookie is not deleted for the next request, and is being sent again with
1
2469
by: sameer | last post by:
Hi all, Environment : ASP.NET I am using cookies to store some data. this is done in a class which is called by a web page CookieCreate.aspx. Here is a little bit of code of how i create the cookie in the class Dim context As HttpContext = HttpContext.Current If Not context.Request.Cookies("CartID") Is Nothing Then
1
2609
by: onceuponapriori | last post by:
Greetings gents. I'm a Railser working on a django app that needs to do some scraping to gather its data. I need to programatically access a site that requires a username and password. Once I post to the login.php page, there seems to be a redirect and it seems that the site is using a session (perhaps a cookie) to determine whether the user is logged in. So I need to log in and then have cookies and or sessions maintained as I access...
3
4031
by: Gregory A Greenman | last post by:
I'm trying to screen scrape a site that requires a password. If I access the site's login page in my browser and view the source, I see that it does not contain a viewstate. When my program posts the login information, the response I get is the same page as if I had logged in using my browser. In the page it says "Welcome" followed by my name. The cookie collection returned doesn't contain any cookies (response.cookies.count = 0).
0
9979
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
9823
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,...
1
10924
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
9637
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...
0
7170
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
5854
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...
1
4681
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
2
4275
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3281
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.