Cookies & Localhost

G

Goober

I have an application where we have a limited number of users and a set
requirement for web access. An app that I have inherited uses cookies to
set certain values (i.e. what would correspond to session variables in
regular ASP) that we use to run reports from a SQL database and display them
in a web browser.

In doing some testing, I noticed that the cookies would remain there for
previous used (if I signed into our app as user 1 and then user 2, user 1's
data would be retained for user2), if I didn't manually delete cookies from
the web browser or initiate a new web browser.

What I wanted to do was to expire all of the cookies for our web app when
the default page was loaded, to ensure that we got a fresh start from there.
However, I can't seem to find them on my localhost.

In testing, I set these 3 cookies in my web page:
Response.Cookies("availabilityrptlevel").Value = "10"

Response.Cookies("sg_sku").Value = 0

Response.Cookies("le_sku").Value = 0



and then read them in elsewhere:



prmfaavailability.Value = Request.Cookies("availabilityrptlevel").Value

Can what I want to do be done? Where do I find these cookies on my
localhost?



BC
 
J

Janaka

If you want to delete your cookies when the default page is loaded try
expiring them using the following:

Dim exCookie as HttpCookie = Request.Cookies("availabilityrptlevel")

If exCookie Is Not Null
exCookie.Expires = DateTime.Now.AddDays(-10)
Response.Cookies.Add(exCookie)
End If
 
G

Goober

Visual Studio doesn't like that and gives me an error on it. It says,

'null' is not declared. 'Null' constant is no longer supported; use
'System.DBNull' instead.

If I change the Null to System.dbnull, it says,
'DBNull' is a type in 'System' and cannot be used as an expression.

If I change it to System.convert.dbnull, it doesn't give me an error in
Visual Studio, but I get a runtime error:

Operator is not valid for type 'DBNull'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Operator is not valid for
type 'DBNull'.


BC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Localhost 0
How to make a iOS browser with different cookies per tab? 0
Cookies Count 2
Frameset missing cookies 1
cookies 1
Using Cookies 0
Can't remove cookies! 7
double cookie 2

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top