How To Clear Cookies In ASP?

I have a website that would set two cookies when a user logs in
successfully.

<%
response.cookies("login_status")="OK"
response.cookies("login_id")="12345"'This value is from database.
response.cookies("login_id").domain="mysitexyz.com"
%>

and I have a question in "removing/deleting/cleaning the cookie when
the user logs out.

From my understanding there are two methods -

#1 (I am currently using)
response.cookies("login_status")=""
response.cookies("login_id")=""

#2
response.cookies("login_status").expires=now
response.cookies("login_id").expires=now

My questions is, what's the difference, advantage and disadvantage of
these two methods?

I am asking this because I have noticed that there are some problems
in #1. In my computer (I use IE7) if I login as one user, logout, and
then login as another user, the cookie value will get mixed up.
Somehow the response.cookies("login_status") can display correctly but
response.cookies("login_id") cannot. But if I clean my browser cache,
close my IE and reopen it, both cookies work fine.

View Replies


ADVERTISEMENT

Creating Cookies In Global.asa Session_OnStart But Cannot Read Cookies On Subsequent Pages.

In my Session_OnStart in Global.asa, I am setting some cookies. One
of them, I set as follows:

dim UserID
UserID = Request.ServerVariables("LOGON_USER")
Response.Cookies("User")("ID") = UCASE(UserID)

When I immediately log the cookie value retrieved from
Request.Cookies("User")("ID") into the Windows Event Log, I get the
correct value. However, when I try to retrieve the cookie on the home
page of my application using the same code,

Request.Cookies("User")("ID"), it either cannot find the cookie or
cannot read the value. I am retrieving the cookie before all HTML
headers are written. It is my first statement on the page after
Option Explicit. I have even compared the session IDs. The SessionID
created in the Session_OnStart is the same value as the SessionID on
the home page.

I have read that the Session_OnStart only has access to the
Application, Session and Request objects. It does not explicitly say
that it does not have access to the Response object. Also, I was even
able to use Response.Write's in Global.asa to print out the values
although it looked like it had also stopped the session after I did
so. Cookies are definitely enabled on my machine. I have even tried
setting the session cookie's expiration to be persistent for a few
days to see if it was perhaps expiring before I was able to read it
but this did not work either.

Is there something preventing cookies to be created in Global.asa in
the Session_OnStart sub? Is the Response object not available???
Please let me know if anyone else has had this problem or solution.

View Replies View Related

Enable Permanent Cookies But Disable Session Cookies

Is it possible for a user to enable permanent cookies but disable session cookies.....this seems like a contradition yet this is what I appear to be
reading in online articles?

View Replies View Related

Creating Cookies File And Stored In Cookies Folder

I m creating a cookies in my application and it work properly but i can't see the cookies where it will sotred i checked the cookies folder but i didn't find that I want to create a cookies file as the other web site create and store where other cookies will stored in Cookies folder or Temprory Internet files folder eg:1. arvind@google.co[1].txt this stored in cookies folder 2. arvind@msn[2].txt ....

View Replies View Related

Clear Session

how can I clear Session("sString") on a hyperlinK?

example:
<a href="default.asp">Goto page 1</a>

the Session("sString") should be "" (blank)

View Replies View Related

Clear Out Array

im using an array inside a do while loop. how do i clear out my array
before i run back through the loop?

View Replies View Related

Clear The Combobox

how to clear the combobox by calling a function in ASP.

View Replies View Related

Clear Information

When I submit information i post it to a page and when it’s reloaded it runs as code accordingly if I refresh it re runs the asp because the information is still posted. How do I clear the posted information? Or possibly after it runs the asp code alter a value in the posted information.

View Replies View Related

Clear Certain Fields

im using the following code to loop thourgh field to prevent same value being added twice by the user in different fields, Code:

View Replies View Related

Clear Session

When I release session objects I do this

session("username")=""

So whats the difference when I do this

set session("username")=nothing
or
session.remove("username")

Isn't I already release it with a null value?

View Replies View Related

Clear The Textarea

i have a form with a textarea(the value is taken out from the database) i would like to know if it is possible to erase contents in that file and not delete it using asp or javascript? or is there a way to select all the text in that textarrea and clear it?

View Replies View Related

Clear A Page

How do i clear a page of boxes and only allow the last response.write to show? And is there a way to allow the page to show for a while the response.write and then bring it to another page by a certain timing?

View Replies View Related

Clear The Session

If the user want to log out from the web site, do i need to provide the any coding to clear the session?

View Replies View Related

Clear Out Cache

Is there any way I can clean the cache at the top of each web page so that users cant use the back button in explorer ?

View Replies View Related

Clear All Values

I need the Clear Button to clear all the fields/values that i have in one of the table in my form. Can that be done?

View Replies View Related

Clear All Connections

Is there a way that i can force a drop of all connections to a database. My problem is Access keeps locking my database, i have multiple users using this database, at different periods of the day, and i need a way to clear all connections, i.e at set points throughout the day or at request.

I do close the connection and set all record sets to nothing not sure what else i am missing?

View Replies View Related

Clear Session Variable

I have a form submission page that I am using some session variables that are created on the page in order to keep track of the information that they have already inputted - so when they click submit if there are any errors the fields that are correct remain populated.However, I am wondering is there a way that if they navigate away from this one page all the session variables that are created are removed so if they come back to the page they need to re-enter the information?

Something like "on page exit - remove session("name")..." ?

View Replies View Related

How Can I Clear All Data From Access DB?

I have an Access database containing 10 Tables with a lot data in each Table. I need to copy the database with no data in another directory. Is there an ASP code or object that allows me to clear data in all Table at once? How can I clear all data from Access DB?

View Replies View Related

Clear Request.ClientCertificate

How can I clear Request.ClientCertificate. When I want clear the session of my digital certificate, I cannot until I close IExplorer.

View Replies View Related

Clear Shopping Cart Tbl

I am worried of accumulated old cart product selections from expired browser windows or other unforseen events. I am holding selected productID's & quantities & userID & sessionID in a sql table from a shopping cart.

I allow user to clear their cart from a button and also automatically clear their cart on user logon. Also on checkout I clear their cart. I am storing selections with sessionID & UserID so they will be unique,. But does anyone reccomend any other cart selection maintenance procedure i could use,.

View Replies View Related

Clear The Back Button History?

The back button that appears on every browser has a list that allows moving back to a specific page quickly, I'm sure you all know the one I mean. Is there a means of clearing said list? perhaps some DHTML method or the like?

View Replies View Related

How To Clear Query String From Url On Refresh?

I have an image gallery in a database and I display one item at random with each refresh. I also have 2 buttons "next" and "previous" to show next or previous items in my recordset. Everything works well except for the fact that once the user has used either "next" or "previous" it leaves my query string in the url bar:
index.asp?action=previous
therefore, if I click "refresh" it continues to display either the next or previous entries instead of dislaying at random like it should.

How can I clear the query string from the url if the commend comes from the refresh button?

View Replies View Related

Flush/clear A Form After Post

Is there any method to clear a form collection after a post without have to do a response.redirect? I am trying to avoid having the form re-submitted a second time on a page refresh.

View Replies View Related

Request.form Usage Not Clear

I am trying to get a thorough understanding of a code where a addition or
deletion of records can be done from a list of records. For addition part of
the form, data is being obtained from set of input boxes. Code:

View Replies View Related

Any Ways To Clear Form Cache Or Prevent User From Pressing The Back Button

Are there ways to let browser forget about the previous submitted form data?

Or prevent user from pressing F5 to submit the same form again

Or prevent user from presising back on the browser?

View Replies View Related

Clear "Logon_user"

I have a non anonymous site in IIS5
The site is for collecting any kind of data from employees.
Authentication is done with the server variable "Logon_User"

Pages:

start.asp - Authentification mask appears -->
form.asp - form for data input -->
form_ack.asp - displays the data again and stores in SQL when
acknowledged in checkboxes

After data are stored I'd like to have a button such as "Log off"
which points back to start.asp.

In the samples I tried there is always the current logged in user
present even when I do a "session.abandon" or
"Session.Contents.Remove"

But how can I "reset" the current logged in user?

View Replies View Related

Cookies

I've added a cookie and I am able to read it when using the same window but
if I load up a new window and try to access it, it can't find the cookie.
Any one know why?

View Replies View Related

Cookies?

I am creating a user tracking app that tracks a user one of two ways...

1)First Method is cookies
2)Second Method MS SQL DB

I first check if the users browser accepts cookies if not I go to the db. If the user accepts cookies then I check for a specific crumb if it does not have the value I am looking for I kill it and rewrite it. This is working fine (im in the middle of testing it). The problem is I decieded to test the script with NN7 and not turn cookies off but block cookies from my site and all fell apart. The condition that I have set (detect if cookies are enabled) does not stop the script from trying to set a Session Variable because the browser accepts cookies and to keep a long story short it goes into an infinite loop because the script is looking for a Session value and Its not being stopped becaues the script thinks its alright to write cookies! Is there a way to detect if a user has your sites cookies blocked? This is important because Server.CreateObject("MSWC.BrowserType") will return .Cookies = True and you will not know that your script is not executing properly because a user has your sites cookies blocked but excepts them elsewhere...

View Replies View Related

Should We Use Cookies??

After a login we have a menu from where we have access to different operations such as add ,delete,update.. but if a user enters the appropriate URL he has access to these operations with out proper authorization.how do we solve this.

should we use cookies,if so how exactly?

View Replies View Related

Log-in Cookies

I've built a website which requires a user to log-in to access the site. I have already built a page that enters their details into a db (register.asp), and another page where the user enters their email address (the log-in ID) to actually log-in (login.asp).

How can I use a cookie to automatically log a user in??

More specifically, what are the commands to set a cookie (upon successful registration) and access it (upon re-logging in)?

View Replies View Related

Using Cookies

Hey i've spent the last few hours trying to work this problem out about cookies.

When a user logs in to the site the login.asp page checks the database to see the personal page that the user re directs to e.g if bob brown logged in he would be redirected to bob.brown.asp. This is stored in a field in the database table along with the username and password.

i would like to put a cookie onto the users computer that remembers the url they were redirected to so when they press the main page button it would look for the cookie and see what url they are meant to be redirected to and take them there

My current login system is this ....

View Replies View Related

Getting Cookies

I'm trying to load up a page through my asp page and get the cookie from that page so that I can use it later on when it needs to have it to access other parts of the site.

Basically the asp page is going to act like a browser and store the cookie from the other site, then send that cookie back when the asp page goes back to the other site again.

The problem is, I can only seem to access my own cookie. I didn't run into this problem when I was doing a similar thing inside my .cs scripts that were run by the server, as I suppose they were not coming from the actual domain that my page is running on (and thus, wasn't getting everything trampled by local cookies).

Is this possible, or should I just give up on it now?

View Replies View Related

Using Cookies - Best Way To Do This?

im building a site for a few doctors surgeries. the user is able to see what appointments are available and then book that date/time. i have a table (in my db) of dates/times and a checkbox to say whether the time has been booked or not (and display only times that havnt been booked). i was going to have the user add the time to a "cart" and then check the "booked" checkbox in my db when theyve paid for that appointment. but if i have lots of people looking at the site at the same time, then they may be able to see times that are just about to be booked. i think a better way is to have the date/time stuffed into a cookie which expires after 5 minutes. so when a user adds a time to their "cart", it will say something like: "this time will expire in 5 minutes until you book it or re-add it to your cart". does that make sense?
how can i do this with server-cide cookies (im using jscript)? can anyone think of a better way to do this?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved